prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Maptopicprio: Polygon may not be set
  When I try to create a maptopic in the dashboard, it is not guaranteed that a polygon is already set. The map for setting a point therefore fails to display.
  
  </issue>
  <code>
  [start of meinberlin/apps/maptopicprio/dashboard.py]
  1 from django.urls import reverse
  2 from django.utils.translation import ugettext_lazy as _
  3 
  4 from meinberlin.apps.dashboard2 import DashboardComponent
  5 from meinberlin.apps.dashboard2 import components
  6 
  7 from . import models
  8 from . import views
  9 
  10 
  11 class MapTopicEditComponent(DashboardComponent):
  12     identifier = 'map_topic_edit'
  13     weight = 20
  14     label = _('Places')
  15 
  16     def is_effective(self, module):
  17         module_app = module.phases[0].content().app
  18         return module_app == 'meinberlin_maptopicprio'
  19 
  20     def get_progress(self, module):
  21         if models.MapTopic.objects.filter(module=module).exists():
  22             return 1, 1
  23         return 0, 1
  24 
  25     def get_base_url(self, module):
  26         return reverse('a4dashboard:maptopic-list', kwargs={
  27             'module_slug': module.slug
  28         })
  29 
  30     def get_urls(self):
  31         return [
  32             (r'^maptopics/module/(?P<module_slug>[-\w_]+)/$',
  33              views.MapTopicListDashboardView.as_view(component=self),
  34              'maptopic-list'),
  35             (r'^maptopics/create/module/(?P<module_slug>[-\w_]+)/$',
  36              views.MapTopicCreateView.as_view(component=self),
  37              'maptopic-create'),
  38             (r'^maptopics/(?P<slug>[-\w_]+)/update/$',
  39              views.MapTopicUpdateView.as_view(component=self),
  40              'maptopic-update'),
  41             (r'^maptopics/(?P<slug>[-\w_]+)/delete/$',
  42              views.MapTopicDeleteView.as_view(component=self),
  43              'maptopic-delete')
  44         ]
  45 
  46 
  47 components.register_module(MapTopicEditComponent())
  48
  [end of meinberlin/apps/maptopicprio/dashboard.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/maptopicprio/dashboard.py b/meinberlin/apps/maptopicprio/dashboard.py
  --- a/meinberlin/apps/maptopicprio/dashboard.py
  +++ b/meinberlin/apps/maptopicprio/dashboard.py
  @@ -15,7 +15,12 @@
   
       def is_effective(self, module):
           module_app = module.phases[0].content().app
  -        return module_app == 'meinberlin_maptopicprio'
  +        if module_app != 'meinberlin_maptopicprio':
  +            return False
  +        elif module.settings_instance.polygon == '':
  +            return False
  +        else:
  +            return True
   
       def get_progress(self, module):
           if models.MapTopic.objects.filter(module=module).exists():
  
verification_info: {"golden_diff": "diff --git a/meinberlin/apps/maptopicprio/dashboard.py b/meinberlin/apps/maptopicprio/dashboard.py\n--- a/meinberlin/apps/maptopicprio/dashboard.py\n+++ b/meinberlin/apps/maptopicprio/dashboard.py\n@@ -15,7 +15,12 @@\n \n     def is_effective(self, module):\n         module_app = module.phases[0].content().app\n-        return module_app == 'meinberlin_maptopicprio'\n+        if module_app != 'meinberlin_maptopicprio':\n+            return False\n+        elif module.settings_instance.polygon == '':\n+            return False\n+        else:\n+            return True\n \n     def get_progress(self, module):\n         if models.MapTopic.objects.filter(module=module).exists():\n", "issue": "Maptopicprio: Polygon may not be set\nWhen I try to create a maptopic in the dashboard, it is not guaranteed that a polygon is already set. The map for setting a point therefore fails to display.\n", "before_files": [{"content": "from django.urls import reverse\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom meinberlin.apps.dashboard2 import DashboardComponent\nfrom meinberlin.apps.dashboard2 import components\n\nfrom . import models\nfrom . import views\n\n\nclass MapTopicEditComponent(DashboardComponent):\n    identifier = 'map_topic_edit'\n    weight = 20\n    label = _('Places')\n\n    def is_effective(self, module):\n        module_app = module.phases[0].content().app\n        return module_app == 'meinberlin_maptopicprio'\n\n    def get_progress(self, module):\n        if models.MapTopic.objects.filter(module=module).exists():\n            return 1, 1\n        return 0, 1\n\n    def get_base_url(self, module):\n        return reverse('a4dashboard:maptopic-list', kwargs={\n            'module_slug': module.slug\n        })\n\n    def get_urls(self):\n        return [\n            (r'^maptopics/module/(?P<module_slug>[-\\w_]+)/$',\n             views.MapTopicListDashboardView.as_view(component=self),\n             'maptopic-list'),\n            (r'^maptopics/create/module/(?P<module_slug>[-\\w_]+)/$',\n             views.MapTopicCreateView.as_view(component=self),\n             'maptopic-create'),\n            (r'^maptopics/(?P<slug>[-\\w_]+)/update/$',\n             views.MapTopicUpdateView.as_view(component=self),\n             'maptopic-update'),\n            (r'^maptopics/(?P<slug>[-\\w_]+)/delete/$',\n             views.MapTopicDeleteView.as_view(component=self),\n             'maptopic-delete')\n        ]\n\n\ncomponents.register_module(MapTopicEditComponent())\n", "path": "meinberlin/apps/maptopicprio/dashboard.py"}]}