Portal Delete run (Super Admin), lab codes #3/#4, Z23 pointer #45, T1017 #46, payer note, login security-image wait

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ManikandanandClaude Opus 5.5 committed 2026-10-29 12:30:38 +05:30
1 parent a8af44e673
commit fafa5285eb
21 files changed
+1509 -63

No files matched your search

+22 -5
View File
@@ -1,7 +1,8 @@
"""
Read-only access to the results table (`dbo.CV_ChargeSummary`, written by
src/ecw_bot/core/results_db.py). SELECT statements only, always
parameterized; one short connection per call.
Access to the results table (`dbo.CV_ChargeSummary`, written by
src/ecw_bot/core/results_db.py): SELECTs, and one DELETE — a whole run, the
Super Admin's Delete run (2026-10-28). Always parameterized; one short
connection per call.
"""
from datetime import date, datetime, timedelta
@@ -61,12 +62,15 @@ class SqlResultsRepo:
self.conn_str = conn_str
self._connect = connect
def _query(self, sql: str, params=()) -> list:
def _open(self):
connect = self._connect
if connect is None:
import pyodbc
connect = pyodbc.connect
conn = connect(self.conn_str, timeout=10)
return connect(self.conn_str, timeout=10)
def _query(self, sql: str, params=()) -> list:
conn = self._open()
try:
cur = conn.cursor().execute(sql, list(params))
cols = [d[0] for d in cur.description]
@@ -74,6 +78,19 @@ class SqlResultsRepo:
finally:
conn.close()
def delete_run(self, run_at) -> int:
"""Every row of the run that started at `run_at` (every row of a
run shares it); how many went."""
conn = self._open()
try:
cur = conn.cursor().execute(
f"DELETE FROM {results_db.TABLE} WHERE run_at = ?", [run_at])
gone = cur.rowcount
conn.commit()
return gone
finally:
conn.close()
def runs(self) -> list:
"""Every run, newest first, with its claim count per Category."""
return self._query(