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.
This commit is contained in:
parent
9d7707ec4c
commit
49f5b6a714
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ build
|
|||||||
config/
|
config/
|
||||||
node_modules
|
node_modules
|
||||||
flatisfy/web/static/assets
|
flatisfy/web/static/assets
|
||||||
|
data/
|
||||||
|
@ -119,7 +119,12 @@ def import_and_filter(config, load_from_db=False):
|
|||||||
# For each flat already in the db, merge it (UPDATE)
|
# For each flat already in the db, merge it (UPDATE)
|
||||||
# instead of adding it
|
# instead of adding it
|
||||||
session.merge(flats_objects.pop(each.id))
|
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())
|
session.add_all(flats_objects.values())
|
||||||
LOGGER.info("Done!")
|
LOGGER.info("Done!")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user