From: Michael Tremer Date: Sun, 1 Mar 2015 20:06:38 +0000 (+0100) Subject: fireinfo: Show total number of updates in the database X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=de14b2975133e9ad14fdcae56ff659415b186758;p=ipfire.org.git fireinfo: Show total number of updates in the database --- diff --git a/templates/fireinfo/stats-admin.html b/templates/fireinfo/stats-admin.html index 1a7e233c..f9c66fa4 100644 --- a/templates/fireinfo/stats-admin.html +++ b/templates/fireinfo/stats-admin.html @@ -12,6 +12,9 @@
{{ _("Archive Size") }}
{{ archive_size }}
+ +
{{ _("Total updates") }}
+
{{ total_updates }}
{% end block %} diff --git a/webapp/backend/fireinfo.py b/webapp/backend/fireinfo.py index 09396dea..b11f6598 100644 --- a/webapp/backend/fireinfo.py +++ b/webapp/backend/fireinfo.py @@ -1354,8 +1354,9 @@ class Fireinfo(Object): if res: return res.count - def get_archives_count(self): - res = self.db.get("SELECT COUNT(*) AS count FROM fireinfo_profiles") + def get_total_updates_count(self, when=None): + res = self.db.get("SELECT COUNT(*) + SUM(updates) AS count \ + FROM fireinfo_profiles WHERE time_created <= then_or_now(%s)", when) if res: return res.count diff --git a/webapp/handlers_fireinfo.py b/webapp/handlers_fireinfo.py index 1a8e504b..29d661c9 100644 --- a/webapp/handlers_fireinfo.py +++ b/webapp/handlers_fireinfo.py @@ -349,6 +349,7 @@ class AdminFireinfoHandler(FireinfoBaseHandler): data = { "archive_size" : self.fireinfo.get_archive_size(when=self.when), + "total_updates" : self.fireinfo.get_total_updates_count(when=self.when), "profiles_with_data" : profiles_with_data, "profiles_all" : profiles_all, }