feat(5.19): auto-send toggle per cont + tinere manuala randuri (held)
Comutator accounts.auto_send_enabled per cont: Auto OFF (default) tine randurile
la ingestie (submissions.held=1), worker-ul (claim_one AND held=0) le sare pana la
eliberare umana (per rand/bulk/auto-release OFF->ON). Snapshot held prin chokepoint
unic held_for_account pe toate caile de ingestie (API, import, reresolve, reactivare).
- schema/migrare: coloana held + index partial idx_submissions_held; auto_send_enabled
- API: echo onest held+motiv (US-010), ruta /prezentari/{id}/trimite-acum
- web: toggle header, modal confirmare tipata, buton Trimite per rand + Trimite toate,
banner coada tinuta imbatranita (L.142), contor "In asteptare (manual)"
- worker: expire_held (US-008, inchide gaura retentie PII), metrics held gauges
- ops: tools/carantina_held + runbook rollback (R4)
Nota review (/code-review high): re-snapshot held lipseste pe caile repune/corectie
(requeue_submission, post_corectie, bulk-fix) — de aliniat separat cu create_prezentari.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -150,6 +150,40 @@ def set_status(conn: sqlite3.Connection, account_id: int, status: str) -> None:
|
||||
)
|
||||
|
||||
|
||||
def get_auto_send(conn: sqlite3.Connection, account_id: int) -> bool:
|
||||
"""Comutatorul Auto per cont (PRD 5.19 US-001): `accounts.auto_send_enabled` ca bool.
|
||||
|
||||
Cont inexistent -> False (Auto OFF: sigur, tine randurile). Nu comita (ca set_active).
|
||||
"""
|
||||
row = conn.execute(
|
||||
"SELECT auto_send_enabled FROM accounts WHERE id=?", (account_id,)
|
||||
).fetchone()
|
||||
if not row:
|
||||
return False
|
||||
return bool(row["auto_send_enabled"])
|
||||
|
||||
|
||||
def set_auto_send(conn: sqlite3.Connection, account_id: int, enabled: bool) -> None:
|
||||
"""Comuta `accounts.auto_send_enabled` (PRD 5.19 US-001). Idempotent (set pe aceeasi
|
||||
valoare nu arunca). Scoped pe cont. Nu comita — respecta conventia fisierului (apelantul
|
||||
comita, ca la set_active/set_status). Cont inexistent -> UPDATE fara efect (no-op sigur).
|
||||
"""
|
||||
conn.execute(
|
||||
"UPDATE accounts SET auto_send_enabled=? WHERE id=?",
|
||||
(1 if enabled else 0, account_id),
|
||||
)
|
||||
|
||||
|
||||
def held_for_account(conn: sqlite3.Connection, account_id: int) -> int:
|
||||
"""Snapshot-ul `held` la ingestie (PRD 5.19 US-001). SURSA UNICA (chokepoint) folosita de
|
||||
TOATE situ-rile de ingestie care scriu `status='queued'` (US-002).
|
||||
|
||||
Intoarce 0 (nu tine) daca `accounts.auto_send_enabled=1`, altfel 1 (tine randul). Cont
|
||||
inexistent -> 1 (sigur: tine randul, nu-l trimite fara comutator explicit).
|
||||
"""
|
||||
return 0 if get_auto_send(conn, account_id) else 1
|
||||
|
||||
|
||||
def set_tier(
|
||||
conn: sqlite3.Connection,
|
||||
account_id: int,
|
||||
|
||||
Reference in New Issue
Block a user