diff --git a/tlapbot/owncast_helpers.py b/tlapbot/owncast_helpers.py
index fd77351..7ad649f 100644
--- a/tlapbot/owncast_helpers.py
+++ b/tlapbot/owncast_helpers.py
@@ -208,6 +208,16 @@ def add_to_milestone(db, redeem_name, points):
return False
+def all_milestones(db):
+ try:
+ cursor = db.execute(
+ """SELECT name, count, goal FROM milestones"""
+ )
+ return cursor.fetchall()
+ except Error as e:
+ current_app.logger.error(f"Error occured selecting all milestones: {e.args[0]}")
+
+
def all_counters(db):
try:
cursor = db.execute(
diff --git a/tlapbot/owncast_redeem_dashboard.py b/tlapbot/owncast_redeem_dashboard.py
index ce29742..fcfc298 100644
--- a/tlapbot/owncast_redeem_dashboard.py
+++ b/tlapbot/owncast_redeem_dashboard.py
@@ -1,7 +1,7 @@
from flask import render_template, Blueprint, request, current_app
from tlapbot.db import get_db
from tlapbot.owncast_helpers import (pretty_redeem_queue, all_counters,
- read_all_users_with_username)
+ all_milestones, read_all_users_with_username)
from datetime import datetime, timezone
bp = Blueprint('redeem_dashboard', __name__)
@@ -19,6 +19,7 @@ def dashboard():
return render_template('dashboard.html',
queue=pretty_redeem_queue(db),
counters=all_counters(db),
+ milestones=all_milestones(db),
redeems=current_app.config['REDEEMS'],
prefix=current_app.config['PREFIX'],
passive=current_app.config['PASSIVE'],
diff --git a/tlapbot/templates/dashboard.html b/tlapbot/templates/dashboard.html
index da7e36a..a501629 100644
--- a/tlapbot/templates/dashboard.html
+++ b/tlapbot/templates/dashboard.html
@@ -11,6 +11,9 @@
{% if not passive %}
+ {% if queue %}
+
+ {% endif %}
{% endif %}
@@ -40,47 +43,59 @@
{% endif %}
{% if not passive %}
- {% if counters %}
-
-
-
- Active counters |
-
-
- {% for counter in counters %}
-
- {{ counter[0] }} |
- {{ counter[1] }} |
-
- {% endfor %}
-
- {% endif %}
-
- {% if queue %}
-
-
-
- Recent redeems |
-
-
- Time |
- Redeem |
- Redeemer |
- Note |
-
-
- {% for row in queue %}
+ {% if counters %}
+
+
+
+ Active counters |
+
+
+ {% for counter in counters %}
- {{ row[0].replace(tzinfo=utc_timezone).astimezone().strftime("%H:%M") }} |
- {{ row[1] }} |
- {{ row[3] }} |
- {% if row[2] %}
- {{ row[2] }} |
- {% endif %}
-
- {% endfor %}
-
- {% endif %}
+ {{ counter[0] }} |
+ {{ counter[1] }} |
+
+ {% endfor %}
+
+ {% endif %}
+ {% if milestones %}
+ {% for milestone in milestones %}
+
+
+
+ {% endfor %}
+ {% endif %}
+ {% endif %}
+
{% if redeems %}