aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2021-08-19 12:30:29 -0400
committerGalen Guyer <galen@galenguyer.com>2021-08-19 12:30:29 -0400
commit123c6f5c545bf43f408e67061440cc0b2d30b981 (patch)
tree593de5a9b7b9c223147ee530593732013f872145
parent9dda1c9ed4e7e039ac894179b2d06c5e6c68180f (diff)
fix error on first run
-rw-r--r--poller/__init__.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/poller/__init__.py b/poller/__init__.py
index aeea1af..24b8e95 100644
--- a/poller/__init__.py
+++ b/poller/__init__.py
@@ -108,8 +108,11 @@ def get_data():
total_staff=-1,
total_students=-1)
print(current_data.serialize())
- if not data_are_same(Day.get_all()[-1], current_data):
- db.session.add(current_data)
+ try:
+ if not data_are_same(Day.get_all()[-1], current_data):
+ db.session.add(current_data)
+ except IndexError:
+ db.session.add(current_data)
dedup()
return current_data
@@ -125,4 +128,4 @@ def dedup():
print('dropped ' + data[i].serialize()['last_updated'])
db.session.commit()
-#get_data()
+get_data()