Skip to content

Commit

Permalink
use ID in unit food import
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Feb 18, 2024
1 parent f085e7f commit 3a349b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cookbook/helper/open_data_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def import_food(self):
'supermarket_category_id': self.slug_id_cache['category'][self.data[datatype][k]['store_category']],
'fdc_id': re.sub(r'\D', '', self.data[datatype][k]['fdc_id']) if self.data[datatype][k]['fdc_id'] != '' else None,
'open_data_slug': k,
'properties_food_unit': unit_g,
'properties_food_unit_id': unit_g.id,
'space': self.request.space.id,
}

Expand All @@ -228,7 +228,7 @@ def import_food(self):

total_count = 0
if self.update_existing and len(update_list) > 0:
Food.objects.bulk_update(update_list, ['name', 'plural_name', 'properties_food_unit', 'supermarket_category_id', 'fdc_id', 'open_data_slug', ])
Food.objects.bulk_update(update_list, ['name', 'plural_name', 'properties_food_unit_id', 'supermarket_category_id', 'fdc_id', 'open_data_slug', ])
total_count += len(update_list)

if len(create_list) > 0:
Expand Down

0 comments on commit 3a349b1

Please sign in to comment.