diff --git a/tlapbot/owncast_helpers.py b/tlapbot/owncast_helpers.py
index 236dcda..2f32438 100644
--- a/tlapbot/owncast_helpers.py
+++ b/tlapbot/owncast_helpers.py
@@ -141,6 +141,15 @@ def clear_redeem_queue(db):
except Error as e:
print("Error occured deleting redeem queue:", e.args[0])
+def all_counters(db):
+ try:
+ cursor = db.execute(
+ """SELECT counters.name, counters.count FROM counters"""
+ )
+ return cursor.fetchall()
+ except Error as e:
+ print("Error occured selecting all counters:", e.args[0])
+
def pretty_redeem_queue(db):
try:
cursor = db.execute(
diff --git a/tlapbot/owncast_redeem_dashboard.py b/tlapbot/owncast_redeem_dashboard.py
index 27c7c64..e0fd390 100644
--- a/tlapbot/owncast_redeem_dashboard.py
+++ b/tlapbot/owncast_redeem_dashboard.py
@@ -7,14 +7,11 @@ bp = Blueprint('redeem_dashboard', __name__)
@bp.route('/dashboard',methods=['GET'])
def dashboard():
- queue = pretty_redeem_queue(get_db())
- number_of_drinks = 0
+ db = get_db()
+ queue = pretty_redeem_queue(db)
+ counters = all_counters(db)
utc_timezone = timezone.utc
- if queue is not None:
- for row in queue:
- if row[1] == "drink":
- number_of_drinks += 1
return render_template('dashboard.html',
queue=queue,
- number_of_drinks=number_of_drinks,
+ counters=counters,
utc_timezone=utc_timezone)
\ No newline at end of file
diff --git a/tlapbot/templates/dashboard.html b/tlapbot/templates/dashboard.html
index f4865e2..5469bd2 100644
--- a/tlapbot/templates/dashboard.html
+++ b/tlapbot/templates/dashboard.html
@@ -5,12 +5,21 @@
Redeems Dashboard
+ {% if counters %}
+
+
+ Counters |
+
+
- Number of drinks: |
- {{ number_of_drinks }} |
+ {% for counter in counters %}
+ {{ counter[0] }} |
+ {{ counter[1] }} |
+ {% endif %}
+
{% if queue %}
@@ -18,6 +27,7 @@
time |
redeem |
redeemer |
+ note |
{% for row in queue %}
@@ -25,6 +35,7 @@
{{ row[0].replace(tzinfo=utc_timezone).astimezone().strftime("%H:%M") }} |
{{ row[1] }} |
{{ row[2] }} |
+ {{ row[3] }} |
{% endfor %}