diff --git a/app/scodoc/sco_abs.py b/app/scodoc/sco_abs.py index 890f4a540..f771ff081 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(), )