Phyks (Lucas Verney) 9 months ago
parent
commit
e284a71a43
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      flatisfy/fetch.py

+ 3
- 2
flatisfy/fetch.py View File

@@ -314,8 +314,9 @@ def fetch_flats(config):
314 314
                     backend=backend,
315 315
                     last_fetch=arrow.get(last_fetch_by_backends[backend]).date()
316 316
                 )
317
-            session.add(last_fetch_in_db)
318
-            session.commit()
317
+            if last_fetch_in_db:
318
+                session.add(last_fetch_in_db)
319
+                session.commit()
319 320
 
320 321
         housing_posts = housing_posts[: config["max_entries"]]
321 322
         LOGGER.info("Fetched %d flats.", len(housing_posts))