try new method to update_trips v2

This commit is contained in:
Florian Bezannier
2020-12-24 10:14:09 +01:00
parent 13e6d4ec3d
commit 589211eb96
3 changed files with 11 additions and 6 deletions
+1 -1
View File
@@ -115,6 +115,7 @@ def update_trips():
try:
web.db.callback_fct = update_trips
update_trips()
min_date = trips[0].start_at
max_date = trips[-1].start_at
@@ -158,4 +159,3 @@ dash_app.layout = dbc.Container(fluid=True, children=[
data_div
])
web.db.update_callback = update_trips
+3
View File
@@ -2,12 +2,15 @@ import sqlite3
from datetime import datetime
import pytz
callback_fct = None
def convert_datetime(st):
return datetime.strptime(st.decode("utf-8"), "%Y-%m-%d %H:%M:%S+00:00").replace(tzinfo=pytz.UTC)
def update_callback():
if callback_fct is not None:
callback_fct()
return
def get_db():