]> git.ipfire.org Git - dbl.git/commitdiff
lists: Account for how many open reports there
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Dec 2025 16:55:51 +0000 (16:55 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Dec 2025 16:57:00 +0000 (16:57 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.sql
src/dnsbl/lists.py
src/dnsbl/reports.py

index 979d86927986a95a87fa919fc92774f1d3302133..7db7a75e035a53c9f2b5240904ca0b475e1d57b9 100644 (file)
@@ -2,7 +2,7 @@
 -- PostgreSQL database dump
 --
 
-\restrict Hq2I33CNLRM7K7kcCycXF0u7UASfMPt7lX7HhX0lOG4SePHngyo8IfElIz9I44O
+\restrict yRgVASc7gN0f8tKEAi5kP5eoBt9MCpuKcneTEiATwCoxABuwGL5zUJdhirU6taT
 
 -- Dumped from database version 17.6 (Debian 17.6-0+deb13u1)
 -- Dumped by pg_dump version 17.6 (Debian 17.6-0+deb13u1)
@@ -84,7 +84,8 @@ CREATE TABLE public.lists (
     license text NOT NULL,
     updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
     description text,
-    total_domains integer DEFAULT 0 NOT NULL
+    total_domains integer DEFAULT 0 NOT NULL,
+    pending_reports integer DEFAULT 0 NOT NULL
 );
 
 
@@ -394,5 +395,5 @@ ALTER TABLE ONLY public.sources
 -- PostgreSQL database dump complete
 --
 
-\unrestrict Hq2I33CNLRM7K7kcCycXF0u7UASfMPt7lX7HhX0lOG4SePHngyo8IfElIz9I44O
+\unrestrict yRgVASc7gN0f8tKEAi5kP5eoBt9MCpuKcneTEiATwCoxABuwGL5zUJdhirU6taT
 
index 125ce02e97b11dc70126890e833194462a236d16..99e7a8bd7107f3975ad474be1ca8e5edecd08970 100644 (file)
@@ -372,3 +372,7 @@ class List(sqlmodel.SQLModel, database.BackendMixin, table=True):
                        Creates a new report for this list
                """
                return self.backend.reports.create(list=self, **kwargs)
+
+       # Pending Reports
+
+       pending_reports : int = 0
index 565ed191055b99804e8d8266f32041f2ecef69df..c96e8912e5ebff8b019a53e31f2d703ff6a96bc7 100644 (file)
@@ -66,6 +66,9 @@ class Reports(object):
                        Report, **kwargs,
                )
 
+               # Increment the counter of the list
+               report.list.pending_reports += 1
+
                return report
 
 
@@ -115,4 +118,7 @@ class Report(sqlmodel.SQLModel, database.BackendMixin, table=True):
        # Close!
 
        def close(self):
-               pass # XXX TODO
+               # Decrement the counter for pending reports
+               report.list.pending_reports -= 1
+
+               # XXX TODO