From 7866743eb8d4d3e0ff19b31fd39c9072e5303768 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 28 Apr 2022 01:13:48 +0200 Subject: [PATCH] Fix: list_abs_date --- app/scodoc/sco_abs.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/scodoc/sco_abs.py b/app/scodoc/sco_abs.py index 890f4a54..f771ff08 100644 --- a/app/scodoc/sco_abs.py +++ b/app/scodoc/sco_abs.py @@ -423,17 +423,19 @@ def list_abs_date(etudid, beg_date=None, end_date=None): print("On rentre") cnx = ndb.GetDBConnexion() cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) - print("Juste avant le SQL") - cursor.execute( - """SELECT jour, matin, estabs, estjust, description FROM ABSENCES A - WHERE A.ETUDID = %(etudid)s""" - + "" + req = """SELECT jour, matin, estabs, estjust, description + FROM ABSENCES A + WHERE A.ETUDID = %(etudid)s""" + ( + "" if beg_date is None else """ AND A.jour >= %(beg_date)s AND A.jour <= %(end_date)s - """, + """ + ) + cursor.execute( + req, vars(), )