From eef02d358a986ee3625fa9d0c3de568260dde393 Mon Sep 17 00:00:00 2001 From: atrc445 Date: Sat, 28 Aug 2021 14:58:59 +0200 Subject: [PATCH] remove time measurements, sort awards --- files/routes/static.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/files/routes/static.py b/files/routes/static.py index 01e9a9df5..43fd269aa 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -45,14 +45,12 @@ def participation_stats(v): @app.get("/paypigs") @auth_desired def patrons(v): - import time - s = time.time() 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) \ + ).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.asc()) \ + .order_by(User.patron.desc(), AwardRelationship.kind.desc()) \ .join(User).all() result = {} @@ -66,9 +64,7 @@ def patrons(v): if kind in AWARDS.keys(): result[user_id]['awards'][kind] = (AWARDS[kind], row['last_award_count']) - r = render_template("patrons.html", v=v, result=result) - print((time.time()-s)*1000, flush=True) - return r + return render_template("patrons.html", v=v, result=result) @app.get("/admins") @auth_desired