diff --git a/chanbans/http.py b/chanbans/http.py index a15a1d6..94b7e2a 100644 --- a/chanbans/http.py +++ b/chanbans/http.py @@ -35,6 +35,11 @@ def static_url(resource: str): return f"{config.STATIC_ROOT}/{resource}" +def stats_table_total(): + return sum(row['bans'] for row in stats_table_data()) + + +@functools.cache def stats_table_data(): with get_db() as db: curs = db.execute("SELECT board, count(*) as bans FROM bans GROUP BY board") @@ -50,6 +55,7 @@ _env.globals.update( "route_url": route_url, "static_url": static_url, "stats_table_data": stats_table_data, + "stats_table_total": stats_table_total, } ) diff --git a/chanbans/templates/stats.html b/chanbans/templates/stats.html index 9708761..654cfcc 100644 --- a/chanbans/templates/stats.html +++ b/chanbans/templates/stats.html @@ -23,6 +23,10 @@
+