]> git.ipfire.org Git - ipfire.org.git/commitdiff
fireinfo: Drop histogram
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 12 Jan 2024 16:22:50 +0000 (16:22 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 12 Jan 2024 16:22:50 +0000 (16:22 +0000)
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 <michael.tremer@ipfire.org>
src/backend/fireinfo.py
src/templates/fireinfo/admin.html
src/web/fireinfo.py

index 686c46a9baf68b22615c45bb8f9751b54cf21940..c3ab7707747b35c95e9905fb51a79a43544c98a9 100644 (file)
@@ -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):
index 345d847d10ed6e6d6e3bebf903a2901706c63f0a..41c1f96fc8ac5d67c5d5bb6fbd30e32bc0d63d95 100644 (file)
                        </div>
                </section>
        {% end %}
-
-       {% if histogram %}
-               <section class="section">
-                       <div class="container">
-                               <table class="table">
-                                       <tr>
-                                               <th>{{ _("Date") }}</th>
-                                               <th>{{ _("Total Profiles") }}</th>
-                                       </tr>
-
-                                       {% for date in sorted(histogram, reverse=True) %}
-                                               <tr>
-                                                       <th scope="row">{{ format_date(date) }}</th>
-                                                       <td>
-                                                               {{ histogram[date] }}
-                                                       </td>
-                                               </tr>
-                                       {% end %}
-                               </table>
-                       </div>
-               </section>
-       {% end %}
 {% end block %}
index 0f11b7cb22cc62e0b02d4d0b03946490603c152a..dd5c67d64fbb948beff3a7145477a4e11df87aa4 100644 (file)
@@ -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)