summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Metzger2020-06-11 13:42:12 +0200
committerLukas Metzger2020-06-11 13:42:12 +0200
commit0787b0f10c3080bb10b95a913cba1355b557c734 (patch)
treeafa0b2a62cbfaf5378b65954ebf23a54ba946450
parentIncreased size of version field in db (diff)
downloadbwlp-statistics-0787b0f10c3080bb10b95a913cba1355b557c734.tar.gz
bwlp-statistics-0787b0f10c3080bb10b95a913cba1355b557c734.tar.xz
bwlp-statistics-0787b0f10c3080bb10b95a913cba1355b557c734.zip
Only show location if data is available
-rw-r--r--dash/pages/locations.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/dash/pages/locations.py b/dash/pages/locations.py
index 85adcfc..c5ed558 100644
--- a/dash/pages/locations.py
+++ b/dash/pages/locations.py
@@ -88,7 +88,7 @@ def make_content_all(days, date):
figure = go.Figure()
figure.add_trace(go.Pie(
labels=[item['locationname'][0:9] for item in data if item['ip'] == sat],
- values=[int(item['totalSessionTime'] / 3600) for item in data if item['ip'] == sat],
+ values=[item['totalSessionTime'] for item in data if item['ip'] == sat],
text=[str(int(item['totalSessionTime'] / 3600)) + ' h' for item in data if item['ip'] == sat],
hole=0.3,
textinfo='none',
@@ -99,7 +99,8 @@ def make_content_all(days, date):
title_text = '<sub>Sessiontime per Location</sub><br>' + sat,
showlegend=False
)
- figures.append(dbc.Col(width=12, md=6, xl=4, children=dcc.Graph(figure=figure)))
+ if len([item for item in data if item['ip'] == sat and item['totalSessionTime'] > 0]) > 0:
+ figures.append(dbc.Col(width=12, md=6, xl=4, children=dcc.Graph(figure=figure)))
return figures