This commit is contained in:
Lucas Verney 2017-09-27 00:16:36 +02:00
parent 9b087729d3
commit fa20d0fcbc
1 changed files with 12 additions and 6 deletions

View File

@ -175,12 +175,15 @@ def main():
fetched_flats = fetch.fetch_flats(config) fetched_flats = fetch.fetch_flats(config)
fetched_flats = cmds.filter_fetched_flats(config, fetched_flats = cmds.filter_fetched_flats(config,
fetched_flats=fetched_flats, fetched_flats=fetched_flats,
fetch_details=True)["new"] fetch_details=True)
# Sort by cost # Sort by cost
fetched_flats = tools.sort_list_of_dicts_by(fetched_flats, "cost") fetched_flats = {
k: tools.sort_list_of_dicts_by(v["new"], "cost")
for k, v in fetched_flats.items()
}
print( print(
tools.pretty_json(sum(fetched_flats.values(), [])) tools.pretty_json(fetched_flats)
) )
return return
# Filter command # Filter command
@ -193,14 +196,17 @@ def main():
config, config,
fetched_flats=fetched_flats, fetched_flats=fetched_flats,
fetch_details=False fetch_details=False
)["new"] )
# Sort by cost # Sort by cost
fetched_flats = tools.sort_list_of_dicts_by(fetched_flats, "cost") fetched_flats = {
k: tools.sort_list_of_dicts_by(v["new"], "cost")
for k, v in fetched_flats.items()
}
# Output to stdout # Output to stdout
print( print(
tools.pretty_json(sum(fetched_flats.values(), [])) tools.pretty_json(fetched_flats)
) )
else: else:
cmds.import_and_filter(config, load_from_db=True) cmds.import_and_filter(config, load_from_db=True)