From cc3cf58f461b507363de8c6f7ec2826cd8056c94 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 12 Nov 2022 18:40:09 -0800 Subject: [PATCH] Show cached counts in admin statistics. --- .../backend/endpoints/admin_endpoints.py | 9 +++++++- .../etiquette_flask/templates/admin.html | 22 ++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/frontends/etiquette_flask/backend/endpoints/admin_endpoints.py b/frontends/etiquette_flask/backend/endpoints/admin_endpoints.py index 02f15ad..66569ad 100644 --- a/frontends/etiquette_flask/backend/endpoints/admin_endpoints.py +++ b/frontends/etiquette_flask/backend/endpoints/admin_endpoints.py @@ -25,7 +25,14 @@ def get_admin(): 'tags': common.P.get_tag_count(), 'users': common.P.get_user_count(), }) - return common.render_template(request, 'admin.html', counts=counts) + cached = dotdict.DotDict({ + 'albums': len(common.P.caches[etiquette.objects.Album]), + 'bookmarks': len(common.P.caches[etiquette.objects.Bookmark]), + 'photos': len(common.P.caches[etiquette.objects.Photo]), + 'tags': len(common.P.caches[etiquette.objects.Tag]), + 'users': len(common.P.caches[etiquette.objects.User]), + }) + return common.render_template(request, 'admin.html', cached=cached, counts=counts) @site.route('/admin/dbdownload') def get_dbdump(): diff --git a/frontends/etiquette_flask/templates/admin.html b/frontends/etiquette_flask/templates/admin.html index 1616150..1a2ee55 100644 --- a/frontends/etiquette_flask/templates/admin.html +++ b/frontends/etiquette_flask/templates/admin.html @@ -14,6 +14,15 @@ @@ -30,11 +39,14 @@

Statistics

-

{{counts.albums}} albums

-

{{counts.bookmarks}} bookmarks

-

{{counts.photos}} photos

-

{{counts.tags}} tags

-

{{counts.users}} users

+ + + + + + + +
StoredCached
Albums{{counts.albums}}{{cached.albums}}
Bookmarks{{counts.bookmarks}}{{cached.bookmarks}}
Photos{{counts.photos}}{{cached.photos}}
Tags{{counts.tags}}{{cached.tags}}
Users{{counts.users}}{{cached.users}}