dashboard milestones stub
This commit is contained in:
parent
2732967e26
commit
68b8588c76
|
@ -208,6 +208,16 @@ def add_to_milestone(db, redeem_name, points):
|
||||||
return False
|
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):
|
def all_counters(db):
|
||||||
try:
|
try:
|
||||||
cursor = db.execute(
|
cursor = db.execute(
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from flask import render_template, Blueprint, request, current_app
|
from flask import render_template, Blueprint, request, current_app
|
||||||
from tlapbot.db import get_db
|
from tlapbot.db import get_db
|
||||||
from tlapbot.owncast_helpers import (pretty_redeem_queue, all_counters,
|
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
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
bp = Blueprint('redeem_dashboard', __name__)
|
bp = Blueprint('redeem_dashboard', __name__)
|
||||||
|
@ -19,6 +19,7 @@ def dashboard():
|
||||||
return render_template('dashboard.html',
|
return render_template('dashboard.html',
|
||||||
queue=pretty_redeem_queue(db),
|
queue=pretty_redeem_queue(db),
|
||||||
counters=all_counters(db),
|
counters=all_counters(db),
|
||||||
|
milestones=all_milestones(db),
|
||||||
redeems=current_app.config['REDEEMS'],
|
redeems=current_app.config['REDEEMS'],
|
||||||
prefix=current_app.config['PREFIX'],
|
prefix=current_app.config['PREFIX'],
|
||||||
passive=current_app.config['PASSIVE'],
|
passive=current_app.config['PASSIVE'],
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<button class="tablinks" onclick="openTab(event, 'dashboard')", id="defaultOpen">Tlapbot dashboard</button>
|
<button class="tablinks" onclick="openTab(event, 'dashboard')", id="defaultOpen">Tlapbot dashboard</button>
|
||||||
{% if not passive %}
|
{% if not passive %}
|
||||||
|
{% if queue %}
|
||||||
|
<button class="tablinks" onclick="openTab(event, 'redeem-queue')">Redeem queue</button>
|
||||||
|
{% endif %}
|
||||||
<button class="tablinks" onclick="openTab(event, 'redeems-list')">Redeems help</button>
|
<button class="tablinks" onclick="openTab(event, 'redeems-list')">Redeems help</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,7 +58,20 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if milestones %}
|
||||||
|
{% for milestone in milestones %}
|
||||||
|
<label for="file"> {{ milestone[0] }}</label>
|
||||||
|
|
||||||
|
<progress id="file" max={{ milestone[2] }} value={{ milestone[1] }}></progress>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</body>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id='redeem-queue' class="tabcontent">
|
||||||
|
<body>
|
||||||
|
<h3>Redeems Queue</h3>
|
||||||
{% if queue %}
|
{% if queue %}
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -81,7 +97,6 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
</body>
|
</body>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -92,6 +107,8 @@
|
||||||
<li><strong>Counter</strong> redeems add +1 to their counter.</li>
|
<li><strong>Counter</strong> redeems add +1 to their counter.</li>
|
||||||
<li><strong>List</strong> redeems get added to the list of recent redeems (without a note).</li>
|
<li><strong>List</strong> redeems get added to the list of recent redeems (without a note).</li>
|
||||||
<li><strong>Note</strong> redeems require you to send a message together with the redeem.</li>
|
<li><strong>Note</strong> redeems require you to send a message together with the redeem.</li>
|
||||||
|
<li><strong>Milestone</strong> redeems are long-term goals to which you can donate any amount of points you want.</li>
|
||||||
|
<li>They will be completed once the amount of points donated reaches the goal.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<body>
|
<body>
|
||||||
{% if redeems %}
|
{% if redeems %}
|
||||||
|
|
Loading…
Reference in New Issue