From: Michael Tremer Date: Fri, 12 Jan 2024 16:22:50 +0000 (+0000) Subject: fireinfo: Drop histogram X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb85fd250bfa08b7fb2f5c3f0a9017216257c02e;p=ipfire.org.git fireinfo: Drop histogram This takes waaaaay to long to render and we will need to come back to this at some later time to implement it in a better way. Signed-off-by: Michael Tremer --- diff --git a/src/backend/fireinfo.py b/src/backend/fireinfo.py index 686c46a9..c3ab7707 100644 --- a/src/backend/fireinfo.py +++ b/src/backend/fireinfo.py @@ -757,27 +757,6 @@ class Fireinfo(Object): return res.count if res else 0 - def get_profile_histogram(self): - today = datetime.date.today() - - t1 = datetime.date(year=today.year - 10, month=today.month, day=1) - t2 = datetime.date(year=today.year, month=today.month, day=1) - - res = self.db.query(""" - SELECT - date, - COUNT(*) AS count - FROM - generate_series(%s, %s, INTERVAL '1 month') date - JOIN - fireinfo ON date >= created_at - AND (expired_at IS NULL OR expired_at > date) - GROUP BY - date - """, t1, t2) - - return { row.date : row.count for row in res } - # Profiles def get_profile(self, profile_id, when=None): diff --git a/src/templates/fireinfo/admin.html b/src/templates/fireinfo/admin.html index 345d847d..41c1f96f 100644 --- a/src/templates/fireinfo/admin.html +++ b/src/templates/fireinfo/admin.html @@ -78,26 +78,4 @@ {% end %} - - {% if histogram %} -
-
- - - - - - - {% for date in sorted(histogram, reverse=True) %} - - - - - {% end %} -
{{ _("Date") }}{{ _("Total Profiles") }}
{{ format_date(date) }} - {{ histogram[date] }} -
-
-
- {% end %} {% end block %} diff --git a/src/web/fireinfo.py b/src/web/fireinfo.py index 0f11b7cb..dd5c67d6 100644 --- a/src/web/fireinfo.py +++ b/src/web/fireinfo.py @@ -174,8 +174,5 @@ class AdminIndexHandler(BaseHandler): # Fetch the ASN map asn_map = self.backend.fireinfo.get_asn_map() - # Fetch the histogram - histogram = self.backend.fireinfo.get_profile_histogram() - self.render("fireinfo/admin.html", with_data=with_data, total=total, - asn_map=asn_map, histogram=histogram) + asn_map=asn_map)