prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Restructure CSS
  - [x] Use `$brand_color`
  - [ ] Break SCSS up into more files 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/pretalx/common/tasks.py`
  Content:
  ```
  1 import hashlib
  2 import os
  3 
  4 import django_libsass
  5 import sass
  6 from django.conf import settings
  7 from django.core.files.base import ContentFile
  8 from django.core.files.storage import default_storage
  9 from django.templatetags.static import static
  10 
  11 from pretalx.celery_app import app
  12 from pretalx.event.models import Event
  13 
  14 
  15 @app.task()
  16 def regenerate_css(event_id: int):
  17     event = Event.objects.get(pk=event_id)
  18     local_apps = ['cfp', 'orga']
  19 
  20     if not event.primary_color:
  21         for local_app in local_apps:
  22             event.settings.delete(f'{local_app}_css_file')
  23         return
  24 
  25     for local_app in local_apps:
  26         sassrules = []
  27         if event.primary_color:
  28             sassrules.append('$brand-primary: {};'.format(event.primary_color))
  29 
  30         path = os.path.join(settings.STATIC_ROOT, local_app, 'scss/main.scss')
  31         sassrules.append(f'@import "{path}";')
  32 
  33         cf = dict(django_libsass.CUSTOM_FUNCTIONS)
  34         cf['static'] = static
  35         css = sass.compile(
  36             string="\n".join(sassrules),
  37             output_style='compressed',
  38             custom_functions=cf
  39         )
  40         checksum = hashlib.sha1(css.encode('utf-8')).hexdigest()
  41         fname = f'{event.slug}/{local_app}.{checksum[:16]}.css'
  42 
  43         if event.settings.get(f'{local_app}_css_checksum', '') != checksum:
  44             newname = default_storage.save(fname, ContentFile(css.encode('utf-8')))
  45             event.settings.set(f'{local_app}_css_file', f'/media/{newname}')
  46             event.settings.set(f'{local_app}_css_checksum', checksum)
  47
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/src/pretalx/common/tasks.py b/src/pretalx/common/tasks.py
  --- a/src/pretalx/common/tasks.py
  +++ b/src/pretalx/common/tasks.py
  @@ -23,12 +23,12 @@
           return
   
       for local_app in local_apps:
  +        path = os.path.join(settings.STATIC_ROOT, local_app, 'scss/main.scss')
           sassrules = []
  +
           if event.primary_color:
               sassrules.append('$brand-primary: {};'.format(event.primary_color))
  -
  -        path = os.path.join(settings.STATIC_ROOT, local_app, 'scss/main.scss')
  -        sassrules.append(f'@import "{path}";')
  +            sassrules.append(f'@import "{path}";')
   
           cf = dict(django_libsass.CUSTOM_FUNCTIONS)
           cf['static'] = static
  
verification_info: {"golden_diff": "diff --git a/src/pretalx/common/tasks.py b/src/pretalx/common/tasks.py\n--- a/src/pretalx/common/tasks.py\n+++ b/src/pretalx/common/tasks.py\n@@ -23,12 +23,12 @@\n         return\n \n     for local_app in local_apps:\n+        path = os.path.join(settings.STATIC_ROOT, local_app, 'scss/main.scss')\n         sassrules = []\n+\n         if event.primary_color:\n             sassrules.append('$brand-primary: {};'.format(event.primary_color))\n-\n-        path = os.path.join(settings.STATIC_ROOT, local_app, 'scss/main.scss')\n-        sassrules.append(f'@import \"{path}\";')\n+            sassrules.append(f'@import \"{path}\";')\n \n         cf = dict(django_libsass.CUSTOM_FUNCTIONS)\n         cf['static'] = static\n", "issue": "Restructure CSS\n- [x] Use `$brand_color`\r\n- [ ] Break SCSS up into more files \n", "before_files": [{"content": "import hashlib\nimport os\n\nimport django_libsass\nimport sass\nfrom django.conf import settings\nfrom django.core.files.base import ContentFile\nfrom django.core.files.storage import default_storage\nfrom django.templatetags.static import static\n\nfrom pretalx.celery_app import app\nfrom pretalx.event.models import Event\n\n\n@app.task()\ndef regenerate_css(event_id: int):\n    event = Event.objects.get(pk=event_id)\n    local_apps = ['cfp', 'orga']\n\n    if not event.primary_color:\n        for local_app in local_apps:\n            event.settings.delete(f'{local_app}_css_file')\n        return\n\n    for local_app in local_apps:\n        sassrules = []\n        if event.primary_color:\n            sassrules.append('$brand-primary: {};'.format(event.primary_color))\n\n        path = os.path.join(settings.STATIC_ROOT, local_app, 'scss/main.scss')\n        sassrules.append(f'@import \"{path}\";')\n\n        cf = dict(django_libsass.CUSTOM_FUNCTIONS)\n        cf['static'] = static\n        css = sass.compile(\n            string=\"\\n\".join(sassrules),\n            output_style='compressed',\n            custom_functions=cf\n        )\n        checksum = hashlib.sha1(css.encode('utf-8')).hexdigest()\n        fname = f'{event.slug}/{local_app}.{checksum[:16]}.css'\n\n        if event.settings.get(f'{local_app}_css_checksum', '') != checksum:\n            newname = default_storage.save(fname, ContentFile(css.encode('utf-8')))\n            event.settings.set(f'{local_app}_css_file', f'/media/{newname}')\n            event.settings.set(f'{local_app}_css_checksum', checksum)\n", "path": "src/pretalx/common/tasks.py"}], "after_files": [{"content": "import hashlib\nimport os\n\nimport django_libsass\nimport sass\nfrom django.conf import settings\nfrom django.core.files.base import ContentFile\nfrom django.core.files.storage import default_storage\nfrom django.templatetags.static import static\n\nfrom pretalx.celery_app import app\nfrom pretalx.event.models import Event\n\n\n@app.task()\ndef regenerate_css(event_id: int):\n    event = Event.objects.get(pk=event_id)\n    local_apps = ['cfp', 'orga']\n\n    if not event.primary_color:\n        for local_app in local_apps:\n            event.settings.delete(f'{local_app}_css_file')\n        return\n\n    for local_app in local_apps:\n        path = os.path.join(settings.STATIC_ROOT, local_app, 'scss/main.scss')\n        sassrules = []\n\n        if event.primary_color:\n            sassrules.append('$brand-primary: {};'.format(event.primary_color))\n            sassrules.append(f'@import \"{path}\";')\n\n        cf = dict(django_libsass.CUSTOM_FUNCTIONS)\n        cf['static'] = static\n        css = sass.compile(\n            string=\"\\n\".join(sassrules),\n            output_style='compressed',\n            custom_functions=cf\n        )\n        checksum = hashlib.sha1(css.encode('utf-8')).hexdigest()\n        fname = f'{event.slug}/{local_app}.{checksum[:16]}.css'\n\n        if event.settings.get(f'{local_app}_css_checksum', '') != checksum:\n            newname = default_storage.save(fname, ContentFile(css.encode('utf-8')))\n            event.settings.set(f'{local_app}_css_file', f'/media/{newname}')\n            event.settings.set(f'{local_app}_css_checksum', checksum)\n", "path": "src/pretalx/common/tasks.py"}]}