handle empty database

This commit is contained in:
Florian Bezannier
2021-01-29 11:21:22 +01:00
parent bcc1408b83
commit 52d2850fe9
3 changed files with 42 additions and 37 deletions
+4 -1
View File
@@ -123,7 +123,6 @@ def update_trips():
try:
web.db.callback_fct = update_trips
update_trips()
min_date = trips[0].start_at
max_date = trips[-1].start_at
min_millis = figures.unix_time_millis(min_date)
@@ -157,6 +156,10 @@ try:
),
html.Div(id="tab-content", className="p-4"),
])])
except (IndexError, TypeError) as e:
logger.debug("Failed to generate figure, there is probably not enough data yet")
data_div = dbc.Alert("No data to show", color="danger")
except:
logger.error("Failed to generate figure, there is probably not enough data yet")
logger.error(traceback.format_exc())