feat(web): paritate editor mapare import-preview cu pagina /mapari
Panoul inline "Operatii de mapat la cod RAR" din preview-ul de import folosea doar sugestii fuzzy si nu arata sursa sugestiei. Acum are paritate 1:1 cu pagina /mapari: aceeasi sugestie_principala (GOLD partajat > SILVER > embeddings k-NN) si acelasi badge sursa (confirmat / similar / non-operatie). - _collect_unmapped_ops primeste `conn`: ataseaza sugestie_principala + surse_sugestie via enrich_suggestions, cu ensure_embeddings_corpus o data inainte de bucla (replica pattern-ul din pending_unmapped). Init default pe fiecare entry (inclusiv conn=None) -> contract template identic. SUGGESTION-ONLY: nu atinge resolve_prestatii/load_mapping (#13). - _web_compute_preview paseaza conn=conn la _collect_unmapped_ops. - _preview_import.html: preselect din sugestie_principala > fuzzy>=60 + badge sursa (clase .sugg-sursa--{confirmat,similar,nul} deja existente in base.html). - Test de paritate TARE: seed embeddings + GOLD/SILVER/NUL, batch import cu needs_mapping, verifica _web_compute_preview()["unmapped_ops"] == pending_unmapped(conn, account) pe sugestie_principala + surse_sugestie, cate un caz per sursa (gold/silver/embedding/nul). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -85,7 +85,8 @@
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token or '' }}">
|
||||
{% for e in unmapped_ops %}
|
||||
{%- set top = e.suggestions[0] if e.suggestions else None -%}
|
||||
{%- set preselect = top.cod_prestatie if (top and top.score >= 60) else '' -%}
|
||||
{# L14-S6: pre-selectare din sugestie_principala (GOLD/SILVER/embedding) > fuzzy>=60 #}
|
||||
{%- set preselect = e.sugestie_principala.cod_prestatie if e.sugestie_principala else (top.cod_prestatie if (top and top.score >= 60) else '') -%}
|
||||
<div class="maprow" style="align-items:flex-end; margin-bottom:10px;">
|
||||
<input type="hidden" name="cod_op_service" value="{{ e.cod_op_service }}">
|
||||
<div class="mapcol grow">
|
||||
@@ -94,9 +95,20 @@
|
||||
{% if e.denumire and e.denumire != e.cod_op_service %}
|
||||
<div class="muted">{{ e.denumire }}</div>
|
||||
{% endif %}
|
||||
{% if e.suggestions %}
|
||||
{% if e.suggestions or e.sugestie_principala or (e.surse_sugestie and e.surse_sugestie.nul) %}
|
||||
<div class="muted" style="font-size:12px; margin-top:4px;">
|
||||
sugestii:
|
||||
{# 5.18 US-007: badge sursa pe sugestia sistemului — confirmat (GOLD) / similar
|
||||
(SILVER+embedding k-NN) / non-operatie (pre-filtru NUL). Suggestion-only. #}
|
||||
{% if e.sugestie_principala %}
|
||||
{% if e.sugestie_principala.sursa == 'gold_partajat' %}
|
||||
<span class="sugg-sursa sugg-sursa--confirmat" title="cod confirmat de un operator">confirmat</span>
|
||||
{% else %}
|
||||
<span class="sugg-sursa sugg-sursa--similar" title="operatie similara deja vazuta (k-NN/exact)">similar</span>
|
||||
{% endif %}
|
||||
{% elif e.surse_sugestie and e.surse_sugestie.nul %}
|
||||
<span class="sugg-sursa sugg-sursa--nul" title="pare non-operatie (ITP/plata/discount...)">non-operatie</span>
|
||||
{% endif %}
|
||||
{% for s in e.suggestions[:3] %}
|
||||
<span class="sugg">{{ s.cod_prestatie }} ({{ s.score|round|int }}%)</span>{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user