From 53b4419ed42cd3e3bcfd24313b4d32fb734d5a06 Mon Sep 17 00:00:00 2001 From: Lili Date: Wed, 14 Sep 2022 14:04:27 +0200 Subject: [PATCH] bugfix: dashboard no longer breaks w/ empty queue --- tlapbot/owncast_redeem_dashboard.py | 7 ++++--- tlapbot/templates/dashboard.html | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tlapbot/owncast_redeem_dashboard.py b/tlapbot/owncast_redeem_dashboard.py index 9274685..df09ee2 100644 --- a/tlapbot/owncast_redeem_dashboard.py +++ b/tlapbot/owncast_redeem_dashboard.py @@ -8,7 +8,8 @@ bp = Blueprint('redeem_dashboard', __name__) def dashboard(): queue = pretty_redeem_queue(get_db()) number_of_drinks = 0 - for row in queue: - if row[1] == "drink": - number_of_drinks += 1 + 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) \ No newline at end of file diff --git a/tlapbot/templates/dashboard.html b/tlapbot/templates/dashboard.html index 2799937..76c8250 100644 --- a/tlapbot/templates/dashboard.html +++ b/tlapbot/templates/dashboard.html @@ -11,7 +11,7 @@ {{ number_of_drinks }} - + {% if queue %} @@ -28,5 +28,6 @@ {% endfor %}
+ {% endif %} \ No newline at end of file