aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'backend/lib/sync.py')
-rw-r--r--backend/lib/sync.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/backend/lib/sync.py b/backend/lib/sync.py
index dbb44c2..c837c23 100644
--- a/backend/lib/sync.py
+++ b/backend/lib/sync.py
@@ -117,10 +117,8 @@ def sync_categories():
data = http_session.get(url)
# TODO: Handle response error (if not data)
categories = data.json()
- existing_categories = {}
# TODO: Use UPSERT instead (on_conflict_do_update) if we can rely on postgresql:9.5
- for cat in Category.query.all():
- existing_categories[cat.name] = cat
+ existing_categories = {cat.name: cat for cat in Category.query.all()}
for category in categories:
if category['name'] in existing_categories:
existing_categories[category['name']].description = category['description']