prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  when bplan is archived, office worker update email is sent
  **URL:** 
  **user:** 
  **expected behaviour:** Office workers only get an update email when bplan is "published, changed or created as draft"
  **behaviour:** The automatic archiving also changes the bplan and by that triggers the email. Thinking about it, it should also trigger the get-point thing (and might result in failure errors being thrown).
  **important screensize:**
  **device & browser:** 
  **Comment/Question:** 
  
  Screenshot?
  
  
  </issue>
  <code>
  [start of meinberlin/apps/bplan/signals.py]
  1 from django.db.models.signals import post_save
  2 from django.dispatch import receiver
  3 
  4 from . import emails
  5 from . import tasks
  6 from .models import Bplan
  7 from .models import Statement
  8 
  9 
  10 @receiver(post_save, sender=Bplan)
  11 def get_location(sender, instance, update_fields, **kwargs):
  12     if instance.identifier and (not update_fields or
  13                                 'point' not in update_fields):
  14         tasks.get_location_information(instance.pk)
  15 
  16 
  17 @receiver(post_save, sender=Statement)
  18 def send_notification(sender, instance, created, **kwargs):
  19     if created:
  20         emails.OfficeWorkerNotification.send(instance)
  21 
  22         if instance.email:
  23             emails.SubmitterConfirmation.send(instance)
  24 
  25 
  26 @receiver(post_save, sender=Bplan)
  27 def send_update(sender, instance, update_fields, **kwargs):
  28     if not update_fields or 'point' not in update_fields:
  29         emails.OfficeWorkerUpdateConfirmation.send(instance)
  30
  [end of meinberlin/apps/bplan/signals.py]
  [start of meinberlin/apps/bplan/management/commands/bplan_auto_archive.py]
  1 from datetime import timedelta
  2 
  3 from django.core.management.base import BaseCommand
  4 from django.utils import timezone
  5 
  6 from meinberlin.apps.bplan import models as bplan_models
  7 
  8 
  9 class Command(BaseCommand):
  10     help = 'Archive finished bplan projects and delete old statements.'
  11 
  12     def handle(self, *args, **options):
  13         bplans = bplan_models.Bplan.objects.filter(is_draft=False)
  14         for bplan in bplans:
  15             if bplan.has_finished and not bplan.is_archived:
  16                 bplan.is_archived = True
  17                 bplan.save()
  18                 self.stdout.write('Archived bplan {}.'.format(bplan.name))
  19 
  20         # Delete statements of archived projects
  21         # To prevent deleting statements that have not been sent by mail yet
  22         # only statements older then 48h are deleted.
  23         num_deleted, _ = bplan_models.Statement.objects\
  24             .filter(module__project__is_archived=True)\
  25             .filter(created__lt=timezone.now() - timedelta(hours=48))\
  26             .delete()
  27         if num_deleted:
  28             self.stdout.write('Deleted {} statements from archived bplans.'
  29                               .format(num_deleted))
  30
  [end of meinberlin/apps/bplan/management/commands/bplan_auto_archive.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/meinberlin/apps/bplan/management/commands/bplan_auto_archive.py b/meinberlin/apps/bplan/management/commands/bplan_auto_archive.py
  --- a/meinberlin/apps/bplan/management/commands/bplan_auto_archive.py
  +++ b/meinberlin/apps/bplan/management/commands/bplan_auto_archive.py
  @@ -14,7 +14,9 @@
           for bplan in bplans:
               if bplan.has_finished and not bplan.is_archived:
                   bplan.is_archived = True
  -                bplan.save()
  +                bplan.save(
  +                    update_fields=['is_archived']
  +                )
                   self.stdout.write('Archived bplan {}.'.format(bplan.name))
   
           # Delete statements of archived projects
  diff --git a/meinberlin/apps/bplan/signals.py b/meinberlin/apps/bplan/signals.py
  --- a/meinberlin/apps/bplan/signals.py
  +++ b/meinberlin/apps/bplan/signals.py
  @@ -10,7 +10,8 @@
   @receiver(post_save, sender=Bplan)
   def get_location(sender, instance, update_fields, **kwargs):
       if instance.identifier and (not update_fields or
  -                                'point' not in update_fields):
  +                                ('point' not in update_fields and
  +                                 'is_archived' not in update_fields)):
           tasks.get_location_information(instance.pk)
   
   
  @@ -25,5 +26,6 @@
   
   @receiver(post_save, sender=Bplan)
   def send_update(sender, instance, update_fields, **kwargs):
  -    if not update_fields or 'point' not in update_fields:
  +    if (not update_fields or ('point' not in update_fields and
  +                              'is_archived' not in update_fields)):
           emails.OfficeWorkerUpdateConfirmation.send(instance)
  
verification_info: {"golden_diff": "diff --git a/meinberlin/apps/bplan/management/commands/bplan_auto_archive.py b/meinberlin/apps/bplan/management/commands/bplan_auto_archive.py\n--- a/meinberlin/apps/bplan/management/commands/bplan_auto_archive.py\n+++ b/meinberlin/apps/bplan/management/commands/bplan_auto_archive.py\n@@ -14,7 +14,9 @@\n         for bplan in bplans:\n             if bplan.has_finished and not bplan.is_archived:\n                 bplan.is_archived = True\n-                bplan.save()\n+                bplan.save(\n+                    update_fields=['is_archived']\n+                )\n                 self.stdout.write('Archived bplan {}.'.format(bplan.name))\n \n         # Delete statements of archived projects\ndiff --git a/meinberlin/apps/bplan/signals.py b/meinberlin/apps/bplan/signals.py\n--- a/meinberlin/apps/bplan/signals.py\n+++ b/meinberlin/apps/bplan/signals.py\n@@ -10,7 +10,8 @@\n @receiver(post_save, sender=Bplan)\n def get_location(sender, instance, update_fields, **kwargs):\n     if instance.identifier and (not update_fields or\n-                                'point' not in update_fields):\n+                                ('point' not in update_fields and\n+                                 'is_archived' not in update_fields)):\n         tasks.get_location_information(instance.pk)\n \n \n@@ -25,5 +26,6 @@\n \n @receiver(post_save, sender=Bplan)\n def send_update(sender, instance, update_fields, **kwargs):\n-    if not update_fields or 'point' not in update_fields:\n+    if (not update_fields or ('point' not in update_fields and\n+                              'is_archived' not in update_fields)):\n         emails.OfficeWorkerUpdateConfirmation.send(instance)\n", "issue": "when bplan is archived, office worker update email is sent\n**URL:** \r\n**user:** \r\n**expected behaviour:** Office workers only get an update email when bplan is \"published, changed or created as draft\"\r\n**behaviour:** The automatic archiving also changes the bplan and by that triggers the email. Thinking about it, it should also trigger the get-point thing (and might result in failure errors being thrown).\r\n**important screensize:**\r\n**device & browser:** \r\n**Comment/Question:** \r\n\r\nScreenshot?\r\n\n", "before_files": [{"content": "from django.db.models.signals import post_save\nfrom django.dispatch import receiver\n\nfrom . import emails\nfrom . import tasks\nfrom .models import Bplan\nfrom .models import Statement\n\n\n@receiver(post_save, sender=Bplan)\ndef get_location(sender, instance, update_fields, **kwargs):\n    if instance.identifier and (not update_fields or\n                                'point' not in update_fields):\n        tasks.get_location_information(instance.pk)\n\n\n@receiver(post_save, sender=Statement)\ndef send_notification(sender, instance, created, **kwargs):\n    if created:\n        emails.OfficeWorkerNotification.send(instance)\n\n        if instance.email:\n            emails.SubmitterConfirmation.send(instance)\n\n\n@receiver(post_save, sender=Bplan)\ndef send_update(sender, instance, update_fields, **kwargs):\n    if not update_fields or 'point' not in update_fields:\n        emails.OfficeWorkerUpdateConfirmation.send(instance)\n", "path": "meinberlin/apps/bplan/signals.py"}, {"content": "from datetime import timedelta\n\nfrom django.core.management.base import BaseCommand\nfrom django.utils import timezone\n\nfrom meinberlin.apps.bplan import models as bplan_models\n\n\nclass Command(BaseCommand):\n    help = 'Archive finished bplan projects and delete old statements.'\n\n    def handle(self, *args, **options):\n        bplans = bplan_models.Bplan.objects.filter(is_draft=False)\n        for bplan in bplans:\n            if bplan.has_finished and not bplan.is_archived:\n                bplan.is_archived = True\n                bplan.save()\n                self.stdout.write('Archived bplan {}.'.format(bplan.name))\n\n        # Delete statements of archived projects\n        # To prevent deleting statements that have not been sent by mail yet\n        # only statements older then 48h are deleted.\n        num_deleted, _ = bplan_models.Statement.objects\\\n            .filter(module__project__is_archived=True)\\\n            .filter(created__lt=timezone.now() - timedelta(hours=48))\\\n            .delete()\n        if num_deleted:\n            self.stdout.write('Deleted {} statements from archived bplans.'\n                              .format(num_deleted))\n", "path": "meinberlin/apps/bplan/management/commands/bplan_auto_archive.py"}]}