feat(ux): import compact + preview format Trimiteri + navigatie + scoatere auto_send (5.11)
8 stories TDD (echipa Sonnet, lead orchestreaza). US-001 scoate hold-ul auto_send din mapare (has_no_auto_send->False, simbol pastrat; cod rezolvat->queued). US-002 scoate bifa auto_send din UI. US-003 preview pas 3 in format .tabel-trimiteri (STARI_PREVIEW + nota_umana_preview, fara repr Python; view-model prez). US-004 filtre layout/stil ca referinta + buton Custom. US-005 navigatie Trimiteri/Mapari sub contoare pe toate paginile. US-006 import <details> nativ colapsabil. US-007 post-commit reveal (OOB _coada/_status + HX-Trigger). US-008 auto-refresh dupa actiuni (nudge eliminat). VERIFY context curat PASS (8/8). /code-review high: 3 buguri reparate (tab nav la self-refresh, pill Custom valori stale, nota_umana_preview precedenta needs_mapping). 934 passed, 1 skipped. Backend trimitere + schema NEATINSE. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -249,10 +249,8 @@ def resolve_prestatii(
|
||||
# Adnotare aditiva: marcheaza ca rezolvat-prin-regula cu pattern-ul
|
||||
# sursa. Payload-harmless (RAR citeste doar cod_prestatie).
|
||||
it["cod_sursa"] = f"{COD_SURSA_TEXT_RULE_PREFIX}{pattern_regula or ''}"
|
||||
# Siguranta: regula cu auto_send=0 rezolva codul dar TINE randul
|
||||
# pentru verificare umana (has_no_auto_send -> True).
|
||||
if not auto_send_regula:
|
||||
it["regula_fara_autosend"] = True
|
||||
# US-001 (PRD 5.11): regula_fara_autosend nu se mai seteaza;
|
||||
# auto_send nu mai tine randul (has_no_auto_send neutralizat).
|
||||
else:
|
||||
it["cod_prestatie"] = None
|
||||
unmapped.append({"cod_op_service": op, "denumire": it.get("denumire")})
|
||||
@@ -410,14 +408,9 @@ def classify_prezentare(
|
||||
if errors:
|
||||
status = "needs_data"
|
||||
rar_error = json.dumps(errors, ensure_ascii=False)
|
||||
elif has_no_auto_send(resolved, mapping_meta):
|
||||
status = "needs_mapping"
|
||||
mesaj = "cod mapat cu auto_send=0; review manual inainte de trimitere"
|
||||
rar_error = json.dumps(
|
||||
{"auto_send": mesaj, **err_mod.eroare("AUTO_SEND_OPRIT", cauza=mesaj)},
|
||||
ensure_ascii=False,
|
||||
)
|
||||
else:
|
||||
# US-001 (PRD 5.11): ramura AUTO_SEND_OPRIT eliminata.
|
||||
# Un cod rezolvat (mapare exacta sau regula text) -> queued direct.
|
||||
status = "queued"
|
||||
rar_error = None
|
||||
|
||||
@@ -432,20 +425,14 @@ def classify_prezentare(
|
||||
|
||||
|
||||
def has_no_auto_send(resolved: list[dict], mapping_meta: dict[str, dict]) -> bool:
|
||||
"""Verifica daca vreun item rezolvat are auto_send=0 (mapare exacta SAU regula text).
|
||||
"""Neutralizat dupa US-001 (PRD 5.11): auto_send nu mai tine randuri in needs_mapping.
|
||||
|
||||
Un cod nou-mapat (operations_mapping) cu auto_send=0 nu trebuie trimis automat.
|
||||
La fel pentru un item rezolvat printr-o REGULA TEXT cu auto_send=0 — marcat de
|
||||
`resolve_prestatii` cu `regula_fara_autosend`. In ambele cazuri randul ramane
|
||||
needs_mapping (review manual) pana cand operatorul activeaza „In coada".
|
||||
Items cu cod_prestatie direct (nu via cod_op_service/regula) nu sunt afectate.
|
||||
Simbolul este PASTRAT (importat in routes.py si import_router.py); stergerea
|
||||
ar produce ImportError la boot. Functia intoarce mereu False — codul rezolvat
|
||||
intra direct in queued, indiferent de valoarea auto_send din mapping_meta.
|
||||
|
||||
Coloanele DB raman cu default=1 (migrare non-distructiva).
|
||||
"""
|
||||
for item in resolved:
|
||||
if item.get("regula_fara_autosend"):
|
||||
return True
|
||||
op = (item.get("cod_op_service") or "").strip()
|
||||
if op and op in mapping_meta and not mapping_meta[op]["auto_send"]:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
@@ -660,18 +647,8 @@ def reresolve_account(conn, account_id: int | None, batch_id: int | None = None)
|
||||
stats["still_blocked"] += 1
|
||||
continue
|
||||
|
||||
# Verifica auto_send inainte de re-queuing.
|
||||
if has_no_auto_send(resolved, mapping_meta):
|
||||
conn.execute(
|
||||
"UPDATE submissions SET payload_json=?, rar_error=?, updated_at=datetime('now') WHERE id=?",
|
||||
(
|
||||
payload_json,
|
||||
json.dumps({"auto_send": "cod mapat cu auto_send=0; review manual inainte de trimitere"}, ensure_ascii=False),
|
||||
r["id"],
|
||||
),
|
||||
)
|
||||
stats["review_manual"] += 1
|
||||
continue
|
||||
# US-001 (PRD 5.11): ramura auto_send eliminata din reresolve.
|
||||
# Un cod rezolvat -> queued direct (review_manual ramane 0).
|
||||
|
||||
errors = validate_prezentare(content)
|
||||
if errors:
|
||||
|
||||
Reference in New Issue
Block a user