From: Michael Tremer Date: Mon, 16 Feb 2026 19:04:50 +0000 (+0000) Subject: reports: Don't remember what got notified X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7019849fbf3100ae3dbefeace1245b9881fdba04;p=dbl.git reports: Don't remember what got notified It is more useful to always receive an email with all open reports. Signed-off-by: Michael Tremer --- diff --git a/src/database.sql b/src/database.sql index 26d3282..70651ce 100644 --- a/src/database.sql +++ b/src/database.sql @@ -2,10 +2,10 @@ -- PostgreSQL database dump -- -\restrict 8YknpWlB9eR9ncLt3ecgbxk8MuuGNYlcvtjH1Z5RakC9PZdxunARHhe6aujfak2 +\restrict O4KmJp4fm1WQRL3AwvOlZctAfBgsUgl2VKAckcThLrnSZl3pdImWPTfY4j1qC83 --- Dumped from database version 17.6 (Debian 17.6-0+deb13u1) --- Dumped by pg_dump version 17.6 (Debian 17.6-0+deb13u1) +-- Dumped from database version 17.7 (Debian 17.7-0+deb13u1) +-- Dumped by pg_dump version 17.7 (Debian 17.7-0+deb13u1) SET statement_timeout = 0; SET lock_timeout = 0; @@ -281,8 +281,7 @@ CREATE TABLE public.reports ( closed_by text, comment text DEFAULT ''::text NOT NULL, block boolean DEFAULT true, - accepted boolean DEFAULT false, - notified_at timestamp with time zone + accepted boolean DEFAULT false ); @@ -642,5 +641,5 @@ ALTER TABLE ONLY public.sources -- PostgreSQL database dump complete -- -\unrestrict 8YknpWlB9eR9ncLt3ecgbxk8MuuGNYlcvtjH1Z5RakC9PZdxunARHhe6aujfak2 +\unrestrict O4KmJp4fm1WQRL3AwvOlZctAfBgsUgl2VKAckcThLrnSZl3pdImWPTfY4j1qC83 diff --git a/src/dbl/reports.py b/src/dbl/reports.py index 6063528..854bd81 100644 --- a/src/dbl/reports.py +++ b/src/dbl/reports.py @@ -87,21 +87,15 @@ class Reports(object): # Fetch all pending reports that have not been notified, yet reports = self.backend.db.fetch( sqlmodel - .update( + .select( Report, ) - .values( - notified_at = sqlmodel.func.current_timestamp(), - ) .where( # Reports must be open Report.closed_at == None, - - # Reports must not have been notified, yet - Report.notified_at == None, ) - .returning( - Report, + .order_by( + Report.reported_at ) ) @@ -278,9 +272,6 @@ class Report(sqlmodel.SQLModel, database.BackendMixin, table=True): # Update the list's stats self.list.update_stats() - # Notified At - notified_at: datetime.datetime | None = None - def _send_opening_notification(self): """ Sends a notification to the reporter when this report is opened.