Fixed order in sponsor/fursuit count pages

This commit is contained in:
Stranck 2024-01-04 21:40:06 +01:00
parent ee25571cd7
commit 866ac5b9d5
1 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ bp = Blueprint("stats", url_prefix="/manage")
@bp.route("/sponsorcount") @bp.route("/sponsorcount")
async def sponsor_count(request, order: Order): async def sponsor_count(request, order: Order):
await request.app.ctx.om.updateCache() await request.app.ctx.om.updateCache()
orders = {key:value for key,value in sorted(request.app.ctx.om.cache.items(), key=lambda x: len(x[1].room_members), reverse=True) if value.status not in ['c', 'e']} orders = {key:value for key,value in sorted(request.app.ctx.om.cache.items(), key=lambda x: x[1].ans('fursona_name')) if value.status not in ['c', 'e']}
tpl = request.app.ctx.tpl.get_template('sponsorcount.html') tpl = request.app.ctx.tpl.get_template('sponsorcount.html')
return html(tpl.render(orders=orders, order=order)) return html(tpl.render(orders=orders, order=order))
@ -23,7 +23,7 @@ async def nose_count(request, order: Order):
@bp.route("/fursuitcount") @bp.route("/fursuitcount")
async def fursuit_count(request, order: Order): async def fursuit_count(request, order: Order):
await request.app.ctx.om.updateCache() await request.app.ctx.om.updateCache()
orders = {key:value for key,value in sorted(request.app.ctx.om.cache.items(), key=lambda x: len(x[1].room_members), reverse=True) if value.status not in ['c', 'e']} orders = {key:value for key,value in sorted(request.app.ctx.om.cache.items(), key=lambda x: x[1].ans('fursona_name')) if value.status not in ['c', 'e']}
tpl = request.app.ctx.tpl.get_template('fursuitcount.html') tpl = request.app.ctx.tpl.get_template('fursuitcount.html')
return html(tpl.render(orders=orders, order=order)) return html(tpl.render(orders=orders, order=order))