diff options
-rw-r--r-- | backend/lib/sync.py | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/backend/lib/sync.py b/backend/lib/sync.py index d292291..7c499b5 100644 --- a/backend/lib/sync.py +++ b/backend/lib/sync.py @@ -131,12 +131,6 @@ def sync_categories(): def sync_packages(): for category in Category.query.all(): - if not category.packages: - print('Category %s has no packages' % category.name) - existing_packages = [] - else: - existing_packages = category.packages.all() - data = http_session.get(pkg_url_base + "categories/" + category.name + ".json") if not data: print("No JSON data for category %s" % category.name) # FIXME: Better handling; mark category as inactive/gone? @@ -144,7 +138,7 @@ def sync_packages(): packages = data.json()['packages'] # TODO: Use UPSERT instead (on_conflict_do_update) - existing_packages = {pkg.name: pkg for pkg in Package.query.all()} + existing_packages = {pkg.name: pkg for pkg in category.packages} for package in packages: if package['name'] in existing_packages: |