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
+7 -5
View File
@@ -3,10 +3,6 @@ dash>=1.18.0
plotly>=4
pandas
oauth2_client
python-dateutil
certifi
urllib3
six
requests
numpy
pytz
@@ -14,4 +10,10 @@ typing
argparse
flask
dash_bootstrap_components
geojson
geojson
#swagger req
certifi >= 14.05.14
six >= 1.10
python_dateutil >= 2.5.3
urllib3 >= 1.15.1
+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():