redeem dashboard now shows in local timezone
This commit is contained in:
parent
1d6bd82ce0
commit
951dc38496
|
@ -1,6 +1,7 @@
|
||||||
from flask import render_template, Blueprint
|
from flask import render_template, Blueprint
|
||||||
from tlapbot.db import get_db
|
from tlapbot.db import get_db
|
||||||
from tlapbot.owncast_helpers import pretty_redeem_queue
|
from tlapbot.owncast_helpers import pretty_redeem_queue
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
bp = Blueprint('redeem_dashboard', __name__)
|
bp = Blueprint('redeem_dashboard', __name__)
|
||||||
|
|
||||||
|
@ -8,8 +9,12 @@ bp = Blueprint('redeem_dashboard', __name__)
|
||||||
def dashboard():
|
def dashboard():
|
||||||
queue = pretty_redeem_queue(get_db())
|
queue = pretty_redeem_queue(get_db())
|
||||||
number_of_drinks = 0
|
number_of_drinks = 0
|
||||||
|
utc_timezone = timezone.utc
|
||||||
if queue is not None:
|
if queue is not None:
|
||||||
for row in queue:
|
for row in queue:
|
||||||
if row[1] == "drink":
|
if row[1] == "drink":
|
||||||
number_of_drinks += 1
|
number_of_drinks += 1
|
||||||
return render_template('dashboard.html', queue=queue, number_of_drinks=number_of_drinks)
|
return render_template('dashboard.html',
|
||||||
|
queue=queue,
|
||||||
|
number_of_drinks=number_of_drinks,
|
||||||
|
utc_timezone=utc_timezone)
|
|
@ -22,7 +22,7 @@
|
||||||
</thead>
|
</thead>
|
||||||
{% for row in queue %}
|
{% for row in queue %}
|
||||||
<tbody>
|
<tbody>
|
||||||
<td>{{ row[0].time() }}</td>
|
<td>{{ row[0].replace(tzinfo=utc_timezone).astimezone().hour}}:{{row[0].replace(tzinfo=utc_timezone).astimezone().minute }}</td>
|
||||||
<td>{{ row[1] }}</td>
|
<td>{{ row[1] }}</td>
|
||||||
<td>{{ row[2] }}</td>
|
<td>{{ row[2] }}</td>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in New Issue