show total number of hats in /hats

master
Aevann1 2022-09-08 20:36:43 +02:00
parent 6077f09ca9
commit 1ce1410268
2 changed files with 3 additions and 1 deletions

View File

@ -29,7 +29,8 @@ def hats(v):
hats = owned + not_owned hats = owned + not_owned
sales = g.db.query(func.sum(User.coins_spent_on_hats)).scalar() 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) num_of_hats = g.db.query(HatDef).count()
return render_template("hats.html", owned_hat_ids=owned_hat_ids, hats=hats, v=v, sales=sales, num_of_hats=num_of_hats)
@app.post("/buy_hat/<hat_id>") @app.post("/buy_hat/<hat_id>")
@auth_required @auth_required

View File

@ -21,6 +21,7 @@
<h5 class="mt-4">Number of hats you designed: {{v.num_of_designed_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">Coins you spent on hats: {{v.coins_spent_on_hats}}</h5>
<h5 class="mt-4">Total hat sales: {{sales}}</h5> <h5 class="mt-4">Total hat sales: {{sales}}</h5>
<h5 class="mt-4">Number of hats: {{num_of_hats}}</h5>
</header> </header>
{% endblock %} {% endblock %}