summaryrefslogtreecommitdiffstats
path: root/dash/pages/dozmod.py
diff options
context:
space:
mode:
authorLukas Metzger2020-07-02 13:18:33 +0200
committerLukas Metzger2020-07-02 13:18:33 +0200
commit17609e1523369c5b29cfc34e2bf8a82fc5b6bd23 (patch)
treeff58aa48e0691acde15176616734dd4374ed7324 /dash/pages/dozmod.py
parentAdded additional prettytime (diff)
downloadbwlp-statistics-17609e1523369c5b29cfc34e2bf8a82fc5b6bd23.tar.gz
bwlp-statistics-17609e1523369c5b29cfc34e2bf8a82fc5b6bd23.tar.xz
bwlp-statistics-17609e1523369c5b29cfc34e2bf8a82fc5b6bd23.zip
Added names for sattelites
Diffstat (limited to 'dash/pages/dozmod.py')
-rw-r--r--dash/pages/dozmod.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/dash/pages/dozmod.py b/dash/pages/dozmod.py
index 4d9fb24..d7db6b5 100644
--- a/dash/pages/dozmod.py
+++ b/dash/pages/dozmod.py
@@ -40,7 +40,7 @@ def layout():
dbc.Col(width=12, lg=6, children=[
dcc.Dropdown(
id='dozmod-satellites',
- options=[{'label': s, 'value': s} for s in get_satellites()],
+ options=[{'label': name, 'value': ip} for ip, name in get_satellites()],
multi=True,
value=[],
placeholder='All Satellites',
@@ -193,9 +193,13 @@ def get_satellites():
dbcon = db.getConnection()
cursor = dbcon.cursor()
- cursor.execute("""SELECT DISTINCT ip FROM reports""")
+ cursor.execute("""
+ SELECT DISTINCT r.ip, COALESCE(nm.name, r.ip) AS name FROM reports r
+ LEFT OUTER JOIN names nm ON r.ip = nm.ip
+ ORDER BY name ASC
+ """)
- data = [item['ip'] for item in cursor.fetchall()]
+ data = [(item['ip'], item['name']) for item in cursor.fetchall()]
db.closeConnection(dbcon)
return data