Jon Solow
commited on
Commit
·
9db9dc4
1
Parent(s):
6d2d129
Add scoreboard page to monitor users signed up
Browse files- src/data_storage.py +7 -0
- src/pages/11_Scoreboard.py +29 -0
src/data_storage.py
CHANGED
@@ -121,3 +121,10 @@ def drop_tables():
|
|
121 |
cur.execute("DROP TABLE user_rosters")
|
122 |
cur.execute("DROP TABLE users")
|
123 |
cur.execute("DROP TABLE tokens")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
cur.execute("DROP TABLE user_rosters")
|
122 |
cur.execute("DROP TABLE users")
|
123 |
cur.execute("DROP TABLE tokens")
|
124 |
+
|
125 |
+
|
126 |
+
def get_all_users():
|
127 |
+
with get_db_connection() as con:
|
128 |
+
cur = con.cursor()
|
129 |
+
all_users = cur.execute("select name from users").fetchall()
|
130 |
+
return all_users
|
src/pages/11_Scoreboard.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import streamlit as st
|
3 |
+
|
4 |
+
from config import DEFAULT_ICON
|
5 |
+
from login import check_password
|
6 |
+
from shared_page import common_page_config
|
7 |
+
|
8 |
+
from data_storage import get_all_users
|
9 |
+
|
10 |
+
|
11 |
+
def display_users():
|
12 |
+
all_users = pd.DataFrame(get_all_users(), columns=["Name"])
|
13 |
+
st.dataframe(all_users, hide_index=True)
|
14 |
+
|
15 |
+
|
16 |
+
def get_page():
|
17 |
+
page_title = "Pool Scoreboard"
|
18 |
+
st.set_page_config(page_title=page_title, page_icon=DEFAULT_ICON, layout="wide")
|
19 |
+
common_page_config()
|
20 |
+
if not check_password():
|
21 |
+
st.write("Sorry, you must be logged in first to play")
|
22 |
+
st.stop()
|
23 |
+
|
24 |
+
st.title(page_title)
|
25 |
+
display_users()
|
26 |
+
|
27 |
+
|
28 |
+
if __name__ == "__main__":
|
29 |
+
get_page()
|