forked from MarseyWorld/MarseyWorld
display total hat sales in /hats
parent
90d32b1381
commit
038452f9a6
|
@ -21,7 +21,8 @@ def hats(v):
|
|||
not_owned = g.db.query(HatDef, User).join(HatDef.author).filter(HatDef.id.notin_(owned_hat_ids)).order_by(HatDef.price, HatDef.name).all()
|
||||
hats = owned + not_owned
|
||||
|
||||
return render_template("hats.html", owned_hat_ids=owned_hat_ids, hats=hats, v=v)
|
||||
sales = g.db.query(func.sum(User.coins_spent_on_hats)).scalar()
|
||||
return render_template("hats.html", owned_hat_ids=owned_hat_ids, hats=hats, v=v, sales=sales)
|
||||
|
||||
@app.post("/buy_hat/<hat_id>")
|
||||
@auth_required
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<h5 class="mt-4">Number of hats you bought: {{v.num_of_owned_hats}}</h5>
|
||||
<h5 class="mt-4">Number of hats you designed: {{v.num_of_designed_hats}}</h5>
|
||||
<h5 class="mt-4">Coins you spent on hats: {{v.coins_spent_on_hats}}</h5>
|
||||
<h5 class="mt-4">Total hat sales: {{sales}}</h5>
|
||||
</header>
|
||||
{% endblock %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue