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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
72973973d4
commit
07038ac431
+12
-1
@@ -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"],
|
||||
|
||||
Reference in New Issue
Block a user