From e284a71a43e9a47ff9b6ad52850c511e4317c393 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Tue, 13 Apr 2021 18:58:55 +0200 Subject: [PATCH] Bugfix --- flatisfy/fetch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flatisfy/fetch.py b/flatisfy/fetch.py index 5ffa089..a13ea85 100644 --- a/flatisfy/fetch.py +++ b/flatisfy/fetch.py @@ -314,8 +314,9 @@ def fetch_flats(config): backend=backend, last_fetch=arrow.get(last_fetch_by_backends[backend]).date() ) - session.add(last_fetch_in_db) - session.commit() + if last_fetch_in_db: + session.add(last_fetch_in_db) + session.commit() housing_posts = housing_posts[: config["max_entries"]] LOGGER.info("Fetched %d flats.", len(housing_posts))