prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Get rid of pack prices multiplication
  PO said that 1C stock now is giving already multiplied prices
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `shopelectro/management/commands/_update_catalog/update_pack.py`
  Content:
  ```
  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.conf import settings
  11 from django.db import models, transaction
  12 
  13 from catalog.models_expressions import Substring
  14 
  15 from shopelectro.exception import UpdateCatalogException
  16 from shopelectro.models import TagQuerySet, TagGroup
  17 
  18 logger = logging.getLogger(__name__)
  19 PRICES = ['price', 'purchase_price', 'wholesale_small', 'wholesale_medium', 'wholesale_large']
  20 
  21 
  22 def find_pack_group() -> TagGroup:
  23     try:
  24         pack_group = TagGroup.objects.get_pack()
  25     except TagGroup.DoesNotExist as error:
  26         raise UpdateCatalogException(
  27             'Update the PACK_GROUP_UUID django settings variable to set the new relevant UUID. '
  28             + str(error)
  29         )
  30     if settings.PACK_GROUP_NAME.lower() not in pack_group.name.lower():
  31         raise UpdateCatalogException(
  32             'The pack group name isn\'t matched with the set name:'
  33             f' Pack group name: {pack_group.name}\n'
  34             f' Set name: {settings.PACK_GROUP_NAME}\n'
  35             'Update the PACK_GROUP_NAME django settings variable to set the new relevant name.'
  36         )
  37 
  38     return pack_group
  39 
  40 
  41 def update_in_packs(packs: TagQuerySet):
  42     """Parse and save in pack quantity values."""
  43     packs = (
  44         packs
  45         .annotate(
  46             in_pack_str=Substring(
  47                 models.F('name'),
  48                 models.Value('[0-9]+\+?[0-9]*')))
  49         .exclude(in_pack_str__exact='')
  50     )
  51 
  52     for pack in packs:
  53         in_pack = sum(map(int, pack.in_pack_str.split('+')))
  54         pack.products.all().update(in_pack=max(in_pack, 1))
  55 
  56 
  57 def update_prices(packs: TagQuerySet):
  58     """Multiply product prices on in pack quantity."""
  59     fields_to_update = {}
  60     for price in PRICES:
  61         fields_to_update[price] = models.F(price) * models.F('in_pack')
  62 
  63     with transaction.atomic():
  64         packs.products().update(**fields_to_update)
  65 
  66 
  67 def main(*args, **kwargs):
  68     packs = find_pack_group().tags.all().prefetch_related('products')
  69     update_in_packs(packs)
  70     update_prices(packs)
  71
  ```
  --- 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/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
  @@ -8,10 +8,9 @@
   import logging
   
   from django.conf import settings
  -from django.db import models, transaction
  +from django.db import models
   
   from catalog.models_expressions import Substring
  -
   from shopelectro.exception import UpdateCatalogException
   from shopelectro.models import TagQuerySet, TagGroup
   
  @@ -54,17 +53,6 @@
           pack.products.all().update(in_pack=max(in_pack, 1))
   
   
  -def update_prices(packs: TagQuerySet):
  -    """Multiply product prices on in pack quantity."""
  -    fields_to_update = {}
  -    for price in PRICES:
  -        fields_to_update[price] = models.F(price) * models.F('in_pack')
  -
  -    with transaction.atomic():
  -        packs.products().update(**fields_to_update)
  -
  -
   def main(*args, **kwargs):
       packs = find_pack_group().tags.all().prefetch_related('products')
       update_in_packs(packs)
  -    update_prices(packs)
  
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@@ -8,10 +8,9 @@\n import logging\n \n from django.conf import settings\n-from django.db import models, transaction\n+from django.db import models\n \n from catalog.models_expressions import Substring\n-\n from shopelectro.exception import UpdateCatalogException\n from shopelectro.models import TagQuerySet, TagGroup\n \n@@ -54,17 +53,6 @@\n         pack.products.all().update(in_pack=max(in_pack, 1))\n \n \n-def 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-\n def main(*args, **kwargs):\n     packs = find_pack_group().tags.all().prefetch_related('products')\n     update_in_packs(packs)\n-    update_prices(packs)\n", "issue": "Get rid of pack prices multiplication\nPO said that 1C stock now is giving already multiplied prices\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.conf import settings\nfrom django.db import models, transaction\n\nfrom catalog.models_expressions import Substring\n\nfrom shopelectro.exception import UpdateCatalogException\nfrom shopelectro.models import TagQuerySet, TagGroup\n\nlogger = logging.getLogger(__name__)\nPRICES = ['price', 'purchase_price', 'wholesale_small', 'wholesale_medium', 'wholesale_large']\n\n\ndef find_pack_group() -> TagGroup:\n    try:\n        pack_group = TagGroup.objects.get_pack()\n    except TagGroup.DoesNotExist as error:\n        raise UpdateCatalogException(\n            'Update the PACK_GROUP_UUID django settings variable to set the new relevant UUID. '\n            + str(error)\n        )\n    if settings.PACK_GROUP_NAME.lower() not in pack_group.name.lower():\n        raise UpdateCatalogException(\n            'The pack group name isn\\'t matched with the set name:'\n            f' Pack group name: {pack_group.name}\\n'\n            f' Set name: {settings.PACK_GROUP_NAME}\\n'\n            'Update the PACK_GROUP_NAME django settings variable to set the new relevant name.'\n        )\n\n    return pack_group\n\n\ndef update_in_packs(packs: TagQuerySet):\n    \"\"\"Parse and save in pack quantity values.\"\"\"\n    packs = (\n        packs\n        .annotate(\n            in_pack_str=Substring(\n                models.F('name'),\n                models.Value('[0-9]+\\+?[0-9]*')))\n        .exclude(in_pack_str__exact='')\n    )\n\n    for pack in packs:\n        in_pack = sum(map(int, pack.in_pack_str.split('+')))\n        pack.products.all().update(in_pack=max(in_pack, 1))\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    packs = find_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"}], "after_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.conf import settings\nfrom django.db import models\n\nfrom catalog.models_expressions import Substring\nfrom shopelectro.exception import UpdateCatalogException\nfrom shopelectro.models import TagQuerySet, TagGroup\n\nlogger = logging.getLogger(__name__)\nPRICES = ['price', 'purchase_price', 'wholesale_small', 'wholesale_medium', 'wholesale_large']\n\n\ndef find_pack_group() -> TagGroup:\n    try:\n        pack_group = TagGroup.objects.get_pack()\n    except TagGroup.DoesNotExist as error:\n        raise UpdateCatalogException(\n            'Update the PACK_GROUP_UUID django settings variable to set the new relevant UUID. '\n            + str(error)\n        )\n    if settings.PACK_GROUP_NAME.lower() not in pack_group.name.lower():\n        raise UpdateCatalogException(\n            'The pack group name isn\\'t matched with the set name:'\n            f' Pack group name: {pack_group.name}\\n'\n            f' Set name: {settings.PACK_GROUP_NAME}\\n'\n            'Update the PACK_GROUP_NAME django settings variable to set the new relevant name.'\n        )\n\n    return pack_group\n\n\ndef update_in_packs(packs: TagQuerySet):\n    \"\"\"Parse and save in pack quantity values.\"\"\"\n    packs = (\n        packs\n        .annotate(\n            in_pack_str=Substring(\n                models.F('name'),\n                models.Value('[0-9]+\\+?[0-9]*')))\n        .exclude(in_pack_str__exact='')\n    )\n\n    for pack in packs:\n        in_pack = sum(map(int, pack.in_pack_str.split('+')))\n        pack.products.all().update(in_pack=max(in_pack, 1))\n\n\ndef main(*args, **kwargs):\n    packs = find_pack_group().tags.all().prefetch_related('products')\n    update_in_packs(packs)\n", "path": "shopelectro/management/commands/_update_catalog/update_pack.py"}]}