furizon_webint/stats.py

13 lines
473 B
Python
Raw Permalink Normal View History

2023-01-19 16:02:57 +00:00
from sanic.response import html
from sanic import Blueprint
2023-01-19 16:02:57 +00:00
from ext import *
bp = Blueprint("stats", url_prefix="/manage")
@bp.route("/nosecount")
async def nose_count(request, order: Order):
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']}
tpl = request.app.ctx.tpl.get_template('nosecount.html')
return html(tpl.render(orders=orders, order=order))