prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Stale import db issue
  PO says the last import was at `<yml_catalog date="2019-05-23 00:38">`
  Check if import db can autolaunch.
  
  Import db is called as catalog update command
  
  
  </issue>
  <code>
  [start of shopelectro/management/commands/_update_catalog/update_pack.py]
  1 """
  2 Update Product.in_pack and prices.
  3 
  4 The update_catalog command always resets product prices to per unit format, so:
  5 1. Parse in pack quantity from Tag.name and save it to Product.in_pack
  6 2. Multiply product prices by in_pack value and save.
  7 """
  8 import logging
  9 
  10 from django.db import models, transaction
  11 
  12 from shopelectro.models import TagQuerySet, TagGroup
  13 
  14 logger = logging.getLogger(__name__)
  15 PRICES = ['price', 'purchase_price', 'wholesale_small', 'wholesale_medium', 'wholesale_large']
  16 
  17 
  18 def update_in_packs(packs: TagQuerySet):
  19     """Parse and save in pack quantity values."""
  20     # @todo #859:60m Implement update_pack and render prices properly.
  21 
  22 
  23 def update_prices(packs: TagQuerySet):
  24     """Multiply product prices on in pack quantity."""
  25     fields_to_update = {}
  26     for price in PRICES:
  27         fields_to_update[price] = models.F(price) * models.F('in_pack')
  28 
  29     with transaction.atomic():
  30         packs.products().update(**fields_to_update)
  31 
  32 
  33 def main(*args, kwargs):
  34     uuid = 'ae30f766-0bb8-11e6-80ea-02d2cc20e118'
  35     pack_group = TagGroup.objects.filter(uuid=uuid).first()
  36     if not pack_group:
  37         logger.error(f'Couldn\'t find "Упаковка" tag group with uuid = "{uuid}".')
  38         return
  39 
  40     return
  41 
  42     packs = pack_group.tags.all().prefetch_related('products')
  43     update_in_packs(packs)
  44     update_prices(packs)
  45
  [end of shopelectro/management/commands/_update_catalog/update_pack.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/shopelectro/management/commands/_update_catalog/update_pack.py b/shopelectro/management/commands/_update_catalog/update_pack.py
  --- a/shopelectro/management/commands/_update_catalog/update_pack.py
  +++ b/shopelectro/management/commands/_update_catalog/update_pack.py
  @@ -30,7 +30,7 @@
           packs.products().update(**fields_to_update)
   
   
  -def main(*args, kwargs):
  +def main(*args, **kwargs):
       uuid = 'ae30f766-0bb8-11e6-80ea-02d2cc20e118'
       pack_group = TagGroup.objects.filter(uuid=uuid).first()
       if not pack_group:
  
verification_info: {"golden_diff": "diff --git a/shopelectro/management/commands/_update_catalog/update_pack.py b/shopelectro/management/commands/_update_catalog/update_pack.py\n--- a/shopelectro/management/commands/_update_catalog/update_pack.py\n+++ b/shopelectro/management/commands/_update_catalog/update_pack.py\n@@ -30,7 +30,7 @@\n         packs.products().update(**fields_to_update)\n \n \n-def main(*args, kwargs):\n+def main(*args, **kwargs):\n     uuid = 'ae30f766-0bb8-11e6-80ea-02d2cc20e118'\n     pack_group = TagGroup.objects.filter(uuid=uuid).first()\n     if not pack_group:\n", "issue": "Stale import db issue\nPO says the last import was at `<yml_catalog date=\"2019-05-23 00:38\">`\r\nCheck if import db can autolaunch.\r\n\r\nImport db is called as catalog update command\r\n\n", "before_files": [{"content": "\"\"\"\nUpdate Product.in_pack and prices.\n\nThe update_catalog command always resets product prices to per unit format, so:\n1. Parse in pack quantity from Tag.name and save it to Product.in_pack\n2. Multiply product prices by in_pack value and save.\n\"\"\"\nimport logging\n\nfrom django.db import models, transaction\n\nfrom shopelectro.models import TagQuerySet, TagGroup\n\nlogger = logging.getLogger(__name__)\nPRICES = ['price', 'purchase_price', 'wholesale_small', 'wholesale_medium', 'wholesale_large']\n\n\ndef update_in_packs(packs: TagQuerySet):\n    \"\"\"Parse and save in pack quantity values.\"\"\"\n    # @todo #859:60m Implement update_pack and render prices properly.\n\n\ndef update_prices(packs: TagQuerySet):\n    \"\"\"Multiply product prices on in pack quantity.\"\"\"\n    fields_to_update = {}\n    for price in PRICES:\n        fields_to_update[price] = models.F(price) * models.F('in_pack')\n\n    with transaction.atomic():\n        packs.products().update(**fields_to_update)\n\n\ndef main(*args, kwargs):\n    uuid = 'ae30f766-0bb8-11e6-80ea-02d2cc20e118'\n    pack_group = TagGroup.objects.filter(uuid=uuid).first()\n    if not pack_group:\n        logger.error(f'Couldn\\'t find \"\u0423\u043f\u0430\u043a\u043e\u0432\u043a\u0430\" tag group with uuid = \"{uuid}\".')\n        return\n\n    return\n\n    packs = pack_group.tags.all().prefetch_related('products')\n    update_in_packs(packs)\n    update_prices(packs)\n", "path": "shopelectro/management/commands/_update_catalog/update_pack.py"}]}