From bf0874d0cc20e030de5dcedd51cd27879389271c Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 12 Sep 2024 11:15:53 -0600 Subject: [PATCH] Updated at --- app.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index 946fc8f..b7354a7 100644 --- a/app.py +++ b/app.py @@ -55,14 +55,15 @@ def insert_alumno_extraccion(datos_html: str, materias_html: str, username_integ cur = conn.cursor() insert_query = """ - INSERT INTO public.alumno_extraccion ("Usuario_claveULSA", datos_html, materias_html, historial_html, materias_actuales_html) - VALUES (%s, TRIM(%s), TRIM(%s), TRIM(%s)::JSONB, TRIM(%s)) + INSERT INTO public.alumno_extraccion ("Usuario_claveULSA", datos_html, materias_html, historial_html, materias_actuales_html, updated_at) + VALUES (%s, TRIM(%s), TRIM(%s), TRIM(%s)::JSONB, TRIM(%s), NOW()) ON CONFLICT ("Usuario_claveULSA") DO UPDATE SET datos_html = EXCLUDED.datos_html, materias_html = EXCLUDED.materias_html, error_message = NULL, registrado = DEFAULT, - historial_html = EXCLUDED.historial_html; + historial_html = EXCLUDED.historial_html, + updated_at = NOW(); """ cur.execute(insert_query, (username_integer, datos_html, materias_html, historial_html, materias_actuales_html)) @@ -84,11 +85,12 @@ def update_alumno_extraccion_error(username_integer: int, error: str): cur = conn.cursor() update_query = """ - INSERT INTO public.alumno_extraccion ("Usuario_claveULSA", error_message) VALUES (%s, %s) + INSERT INTO public.alumno_extraccion ("Usuario_claveULSA", error_message, updated_at) VALUES (%s, %s, NOW()) ON CONFLICT ("Usuario_claveULSA") DO UPDATE SET error_message = EXCLUDED.error_message, materias_html = DEFAULT, - registrado = DEFAULT; + registrado = DEFAULT, + updated_at = NOW(); """ cur.execute(update_query, (username_integer, error[:255]))