fix: use DATEADD(MINUTE, -n, CURRENT_TIMESTAMP) for Firebird interval

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-21 16:24:09 -05:00
co-authored by Claude Sonnet 4.6
parent 04d2eb5563
commit 329157ca7a
+2 -2
View File
@@ -58,7 +58,7 @@ LEFT JOIN EMPRESA_SUB es ON TRIM(es.NIT_EMP) = TRIM(r.NIT_EMPRESA)
AND TRIM(es.SUBGRUPO) = TRIM(r.SUBGRUPO)
LEFT JOIN TARIFA t ON TRIM(t.COD_EXAMEN) = TRIM(rel.COD_EXAMEN)
AND t.TARIFA = COALESCE(es.TARIFA, e.TARIFA)
WHERE r.HORAINICIORECEPCION >= CAST('NOW' AS TIMESTAMP) - ? MINUTE
WHERE r.HORAINICIORECEPCION >= DATEADD(MINUTE, ?, CURRENT_TIMESTAMP)
ORDER BY r.IDRECEPCION
"""
@@ -125,7 +125,7 @@ async def sync_recientes(ventana_min: int = 2) -> dict:
return {"ok": False, "error": f"Firebird: {msg}"}
ok_pac, err_pac, rows_pac = fb.execute_query(_SQL_HOY, None)
ok_ex, _, rows_ex = fb.execute_query(_SQL_EXAMENES_VENTANA, (ventana_min,))
ok_ex, _, rows_ex = fb.execute_query(_SQL_EXAMENES_VENTANA, (-ventana_min,))
fb.disconnect()
if not ok_pac: