From 2d4e0816d475d7c5e4033216bf33757c38a7249e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 24 Nov 2021 14:20:52 +0200 Subject: [PATCH] sdffsd --- files/routes/static.py | 21 ++------------------- files/templates/patrons.html | 16 +++------------- 2 files changed, 5 insertions(+), 32 deletions(-) diff --git a/files/routes/static.py b/files/routes/static.py index 65c9df7005..8d9df7104b 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -142,26 +142,9 @@ def cached_chart(): @app.get("/paypigs") @admin_level_required(3) def patrons(v): - query = g.db.query( - User.id, User.username, User.patron, User.namecolor, - AwardRelationship.kind.label('last_award_kind'), func.count(AwardRelationship.id).label('last_award_count') - ).filter(AwardRelationship.submission_id==None, AwardRelationship.comment_id==None, User.patron > 0) \ - .group_by(User.username, User.patron, User.id, User.namecolor, AwardRelationship.kind) \ - .order_by(User.patron.desc(), AwardRelationship.kind.desc()) \ - .join(User).all() + users = g.db.query(User).filter(User.patron > 0).order_by(User.patron.desc()).all() - result = {} - for row in (r._asdict() for r in query): - user_id = row['id'] - if user_id not in result: - result[user_id] = row - result[user_id]['awards'] = {} - - kind = row['last_award_kind'] - if kind in AWARDS.keys(): - result[user_id]['awards'][kind] = (AWARDS[kind], row['last_award_count']) - - return render_template("patrons.html", v=v, result=result) + return render_template("patrons.html", v=v, users=users) @app.get("/admins") @app.get("/badmins") diff --git a/files/templates/patrons.html b/files/templates/patrons.html index 9c00170492..107e13dfba 100644 --- a/files/templates/patrons.html +++ b/files/templates/patrons.html @@ -7,24 +7,14 @@ # Name Tier - Awards -{% for uid,row in result.items() %} +{% for u in users %} {{loop.index}} - {{row['username']}} + {{u.username}} - - - - {% for (a,count) in row['awards'].values() %} - - - {{count}} - - {% endfor %} - + {% endfor %}