Browse Source

Status of flats was not correctly set at first import

When importing flats for the first time, their status was not correctly
set, resulting in flats not being marked as ignored when they should be.

This is a bug introduced with the fix for issue #31, now fixed.
responsive
Lucas Verney 5 years ago
parent
commit
49f5b6a714
  1. 1
      .gitignore
  2. 7
      flatisfy/cmds.py

1
.gitignore vendored

@ -6,3 +6,4 @@ build @@ -6,3 +6,4 @@ build
config/
node_modules
flatisfy/web/static/assets
data/

7
flatisfy/cmds.py

@ -119,7 +119,12 @@ def import_and_filter(config, load_from_db=False): @@ -119,7 +119,12 @@ def import_and_filter(config, load_from_db=False):
# For each flat already in the db, merge it (UPDATE)
# instead of adding it
session.merge(flats_objects.pop(each.id))
# Add (INSERT) all the other flats in the db
# For any other flat, it is not already in the database, so we can
# just set the status field without worrying
for flat in flats_objects.values():
flat.status = getattr(flat_model.FlatStatus, status)
session.add_all(flats_objects.values())
LOGGER.info("Done!")

Loading…
Cancel
Save