From cd59450e5f9f7cb24771570bdc0759e9750acd3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorem=20Ju=C3=A1rez?= Date: Mon, 16 Nov 2026 17:44:33 -0600 Subject: [PATCH] =?UTF-8?q?feat(screening):=20bot=C3=B3n=20Listas=20y=20um?= =?UTF-8?q?brales=20y=20l=C3=ADnea=20con=20la=20versi=C3=B3n=20vigente=20d?= =?UTF-8?q?e=20cada=20lista?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/routers/screening.py | 7 +++++++ app/templates/screening/index.html | 16 ++++++++++------ tests/test_screening.py | 8 ++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/app/routers/screening.py b/app/routers/screening.py index 9621c89..26b537e 100644 --- a/app/routers/screening.py +++ b/app/routers/screening.py @@ -40,6 +40,8 @@ router = APIRouter(tags=["screening"]) ROLES_DECIDEN = (Rol.ANALISTA, Rol.OFICIAL) POR_PAGINA = 50 TITULOS = {clave: d.titulo for clave, d in LISTAS.items()} +# Cómo se nombra cada lista en la línea de versiones del encabezado de la bandeja. +CORTOS = {"ofac_sdn": "OFAC", "onu": "ONU", "sat_69b": "69-B", "pep": "PEP"} def _pendientes(request: Request) -> int | None: @@ -171,6 +173,7 @@ def bandeja( consulta.order_by(*ORDEN_BANDEJA).offset((pagina - 1) * POR_PAGINA).limit(POR_PAGINA) ).all() nombres = _nombres(db, {c.id for _, _, c in filas}) + vigentes = servicio.listas_vigentes(db, tenant) nacionalidades = _nacionalidades(db, [c for _, _, c in filas]) return render( request, @@ -213,6 +216,10 @@ def bandeja( "pagina": pagina, "paginas": max(1, -(-total // POR_PAGINA)), "pendientes": servicio.pendientes(db, tenant), + # «OFAC al 07/10/2026 · ONU al … · 69-B al …»: la versión vigente de cada lista. + "versiones_listas": [ + (CORTOS.get(clave, TITULOS[clave]), vigentes.get(clave)) for clave in LISTAS + ], "aviso": request.query_params.get("aviso"), "error": request.query_params.get("error"), }, diff --git a/app/templates/screening/index.html b/app/templates/screening/index.html index 5442b10..77d78b6 100644 --- a/app/templates/screening/index.html +++ b/app/templates/screening/index.html @@ -25,12 +25,16 @@ {% block contenido %}
-

Screening contra listas

-

- Coincidencias aproximadas contra OFAC SDN, Consejo de Seguridad de la ONU, artículo 69-B del SAT y PEP (lista de ejemplo) {{ pendiente("pep_bajo_nivel") }}. - {{ badge(pendientes ~ " pendiente" ~ ("s" if pendientes != 1 else ""), "aviso" if pendientes else "exito") }} - · Listas cargadas y umbrales {{ pendiente("umbrales_screening") }} -

+
+

Screening contra listas

+

+ {%- for corto, lista in versiones_listas %}{{ " · " if not loop.first }}{{ corto }} {% if lista %}al {{ lista.fecha_version.strftime("%d/%m/%Y") }}{% else %}sin cargar{% endif %}{% endfor %}

+

+ Coincidencias aproximadas contra OFAC SDN, Consejo de Seguridad de la ONU, artículo 69-B del SAT y PEP (lista de ejemplo) {{ pendiente("pep_bajo_nivel") }}. + {{ badge(pendientes ~ " pendiente" ~ ("s" if pendientes != 1 else ""), "aviso" if pendientes else "exito") }} +

+
+ Listas y umbrales{{ pendiente("umbrales_screening") }}
{% if aviso %}{% endif %} diff --git a/tests/test_screening.py b/tests/test_screening.py index 9359cdd..992f938 100644 --- a/tests/test_screening.py +++ b/tests/test_screening.py @@ -730,3 +730,11 @@ def test_el_pais_de_la_lista_dice_si_es_nacionalidad_o_domicilio( detalle = cliente.get(f"/screening/{entidad_id}").text assert "
País (domicilio)
" in detalle assert "
Nacionalidad
México
" in detalle + + +def test_encabezado_con_versiones_de_las_listas_y_boton_de_listas(cliente: TestClient) -> None: + entrar(cliente, Rol.ANALISTA) + html = cliente.get("/screening").text + assert "Listas cargadas y umbrales" not in html + assert 'href="/screening/listas" data-listas-y-umbrales>Listas y umbrales' in html + assert "OFAC al 01/01/2026 · ONU al 01/01/2026 · 69-B al 01/01/2026 · PEP al 01/01/2026" in html