]> git.ipfire.org Git - people/shoehn/ipfire.org.git/commitdiff
fireinfo: Show total number of updates in the database
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 1 Mar 2015 20:06:38 +0000 (21:06 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 1 Mar 2015 20:06:38 +0000 (21:06 +0100)
templates/fireinfo/stats-admin.html
webapp/backend/fireinfo.py
webapp/handlers_fireinfo.py

index 1a7e233c4991acf61fa833bac8ff19e8eadf128e..f9c66fa4c99b391ad1185bb85af3558899c7b748 100644 (file)
@@ -12,6 +12,9 @@
 
                <dt>{{ _("Archive Size") }}</dt>
                <dd>{{ archive_size }}</dd>
+
+               <dt>{{ _("Total updates") }}</dt>
+               <dd>{{ total_updates }}</dd>
        </dl>
 {% end block %}
 
index 09396dea2c67565279b2741633137f769c33e72d..b11f65985d77af287087ee281def713792e14be3 100644 (file)
@@ -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
index 1a8e504bea3a624d6b53024b2704b58acd4db276..29d661c9b76faea9ec8485681715470561dfc930 100644 (file)
@@ -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,
                }