2022-09-07 16:44:59 +02:00
|
|
|
from flask import render_template, Blueprint
|
|
|
|
from tlapbot.db import get_db
|
2022-09-09 12:35:46 +02:00
|
|
|
from tlapbot.owncast_helpers import pretty_redeem_queue
|
2022-09-07 16:44:59 +02:00
|
|
|
|
|
|
|
bp = Blueprint('redeem_dashboard', __name__)
|
|
|
|
|
|
|
|
@bp.route('/dashboard',methods=['GET'])
|
|
|
|
def dashboard():
|
2022-09-09 12:35:46 +02:00
|
|
|
queue = pretty_redeem_queue(get_db())
|
2022-09-07 16:44:59 +02:00
|
|
|
number_of_drinks = 0
|
2022-09-14 14:04:27 +02:00
|
|
|
if queue is not None:
|
|
|
|
for row in queue:
|
|
|
|
if row[1] == "drink":
|
|
|
|
number_of_drinks += 1
|
2022-09-07 16:44:59 +02:00
|
|
|
return render_template('dashboard.html', queue=queue, number_of_drinks=number_of_drinks)
|