master
Aevann1 2021-09-08 10:57:40 +02:00
parent 647f941bc5
commit 975096147b
2 changed files with 11 additions and 5 deletions

View File

@ -68,10 +68,11 @@ def shop(v):
for row in (r._asdict() for r in query):
kind = row['last_award_kind']
if kind in AWARDS.keys():
owned.append((AWARDS[kind], row['last_award_count']))
award = AWARDS[kind]
award["owned_num"] = row['last_award_count']
print(owned)
return render_template("shop.html", owned=owned.values(), awards=list(AWARDS.values()), v=v)
return render_template("shop.html", owned=owned, awards=list(AWARDS.values()), v=v)
@app.post("/buy/<award>")
@auth_required

View File

@ -33,23 +33,26 @@
<pre></pre>
<pre></pre>
<h5>Owned</h5>
<h5>Owned Awards</h5>
<table class="table table-striped">
<thead class="bg-primary text-white">
<tr>
<th scope="col">Icon</th>
<th scope="col">Title</th>
<th scope="col">Description</th>
<th scope="col">Number</th>
<th scope="col">Owned</th>
</tr>
</thead>
<tbody>
{% for a in awards %}
{% for a in owned %}
<tr>
<td><i class="{{a['icon']}} {{a['color']}}" style="font-size: 30px"></i></td>
<td style="font-weight: bold">{{a['title']}}</td>
<td style="font-weight: bold">{{a['description']}}</td>
<td style="font-weight: bold">{{a['price']}}</td>
{% set kind = a['kind'] %}
<td style="font-weight: bold">{{a['owned_num']}}</td>
</tr>
{% endfor %}
</table>
@ -66,6 +69,7 @@
<tr>
<th scope="col">Icon</th>
<th scope="col">Title</th>
<th scope="col">Description</th>
<th scope="col">Price</th>
<th scope="col">Buy</th>
</tr>
@ -75,6 +79,7 @@
<tr>
<td><i class="{{a['icon']}} {{a['color']}}" style="font-size: 30px"></i></td>
<td style="font-weight: bold">{{a['title']}}</td>
<td style="font-weight: bold">{{a['description']}}</td>
<td style="font-weight: bold">{{a['price']}}</td>
{% set kind = a['kind'] %}
<td style="font-weight: bold"><a class="btn btn-success" href="javascript:void(0)" onclick="post_toast('/buy/{{kind}}')">Buy</a></td>