prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Restructure CSS
  - [x] Use `$brand_color`
  - [ ] Break SCSS up into more files 
  
  </issue>
  <code>
  [start of src/pretalx/common/tasks.py]
  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 of src/pretalx/common/tasks.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
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"}]}