add stats to about page

migrate-new-models
lza_menace 2 years ago
parent a6aea485af
commit faebd00fd5

@ -3,6 +3,7 @@ from math import ceil
from flask import Blueprint, request, render_template, flash
from suchwow._models import Post, User, TipReceived
from suchwow.wownero import from_atomic
bp = Blueprint('main', 'main')
@ -50,4 +51,10 @@ def index():
@bp.route("/about")
def about():
mods = User.select().where(User.moderator == True)
return render_template("about.html", mods=mods)
return render_template(
"about.html",
mods=mods,
meme_count=Post.select().where(Post.approved == True).count(),
wow_received=round(from_atomic(sum([i.amount for i in TipReceived.select()])), 2),
memer_count=User.select().count(),
)

@ -2,6 +2,27 @@
{% block content %}
<nav class="level" style="margin: 3em 0">
<div class="level-item has-text-centered">
<div>
<p class="heading">Memes</p>
<p class="title">{{ meme_count }}</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Tips</p>
<p class="title">{{ wow_received }} WOW</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Memers</p>
<p class="title">{{ memer_count }}</p>
</div>
</div>
</nav>
<div class="container" style="text-align:center;">
<div class="about content">
<h1>About</h1>

Loading…
Cancel
Save