From 07038ac431386593a800301c12f42523b55932a8 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Wed, 1 Jul 2026 17:36:45 -0500 Subject: [PATCH] fix: clean time spaces in logs view without modifying stored data Applies _clean_times when serving json_enviado in /logs/detalle so old records with "12: 47: 37" display correctly as "12:47:37". Co-Authored-By: Claude Sonnet 4.6 --- app/routes/logs.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/routes/logs.py b/app/routes/logs.py index 0a4eae4..6085293 100644 --- a/app/routes/logs.py +++ b/app/routes/logs.py @@ -1,10 +1,21 @@ +import json as json_lib from fastapi import APIRouter, Request, Depends from fastapi.responses import JSONResponse from app.database import get_connection from app.auth import get_current_user +from app.services.json_generator import _clean_times router = APIRouter(prefix="/logs", tags=["logs"]) + +def _limpiar_json_enviado(raw: str) -> str: + if not raw: + return raw + try: + return json_lib.dumps(_clean_times(json_lib.loads(raw)), ensure_ascii=False, indent=2) + except Exception: + return raw + PAGE_SIZE = 50 @@ -95,7 +106,7 @@ async def detalle_envio(envio_id: int, request: Request, user: dict = Depends(ge "status": row["status"], "mensaje_tns": row["mensaje_tns"], "respuesta_api": row["respuesta_api"], - "json_enviado": row["json_enviado"], + "json_enviado": _limpiar_json_enviado(row["json_enviado"]), "fecha_inicio": row["fecha_inicio"], "fecha_fin": row["fecha_fin"], "created_at": row["created_at"],