Materias que cursa actualmente
This commit is contained in:
6
app.py
6
app.py
@@ -60,7 +60,7 @@ def insert_alumno_extraccion(datos_html: str, materias_html: str, username_integ
|
||||
|
||||
insert_query = """
|
||||
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())
|
||||
VALUES (%s, TRIM(%s), TRIM(%s), TRIM(%s)::JSONB, TRIM(%s)::JSONB, NOW())
|
||||
ON CONFLICT ("Usuario_claveULSA") DO UPDATE
|
||||
SET datos_html = EXCLUDED.datos_html,
|
||||
materias_actuales_html = EXCLUDED.materias_actuales_html,
|
||||
@@ -162,6 +162,9 @@ def extract(driver, username: str, password: str):
|
||||
historial_html_io = StringIO(f"<table>{historial_html}</table>")
|
||||
materias_html_io = StringIO(f"<table>{materias_actuales_html}</table>")
|
||||
df = pd.read_html(historial_html_io)[0]
|
||||
df_materias = pd.read_html(materias_html_io)[0]
|
||||
|
||||
df_materias = df_materias.drop(columns=['Unnamed: 0', 'Seleccionar'])
|
||||
|
||||
json_result = None
|
||||
json_materias = None
|
||||
@@ -170,7 +173,6 @@ def extract(driver, username: str, password: str):
|
||||
df['PERIODO'] = df['PERIODO'].apply(lambda x: str(x).replace('.0', '') if isinstance(x, (float, int)) else x)
|
||||
json_result = df[df['GRUPO'] != 'Promedio:'].to_json(orient='records')
|
||||
|
||||
df_materias = pd.read_html(materias_html_io)[0]
|
||||
json_materias = df_materias.to_json(orient='records')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user