bugfix: dashboard no longer breaks w/ empty queue

This commit is contained in:
Lili (Tlapka) 2022-09-14 14:04:27 +02:00
parent 55ab9c774a
commit 53b4419ed4
2 changed files with 6 additions and 4 deletions

View File

@ -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)

View File

@ -11,7 +11,7 @@
<td> {{ number_of_drinks }} </td>
</tbody>
</table>
{% if queue %}
<table>
<thead>
<tr>
@ -28,5 +28,6 @@
</tbody>
{% endfor %}
</table>
{% endif %}
</body>
</html>