From 3527d2bba1a9ef4d5ee20fdf4950c9ffdb73aca8 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 13 Sep 2021 09:55:49 +0200 Subject: [PATCH] 2 bugs: XMLgetAbsEtud, doSignaleAbsenceGrSemestre --- app/views/absences.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/views/absences.py b/app/views/absences.py index d944b84e7..1cc93f62e 100644 --- a/app/views/absences.py +++ b/app/views/absences.py @@ -79,7 +79,7 @@ from app.scodoc import notesdb as ndb from app import log from app.scodoc.scolog import logdb from app.scodoc.sco_permissions import Permission -from app.scodoc.sco_exceptions import ScoValueError, ScoInvalidDateError +from app.scodoc.sco_exceptions import ScoValueError, APIInvalidParams from app.scodoc.TrivialFormulator import TrivialFormulator from app.scodoc.gen_tables import GenTable from app.scodoc import html_sco_header @@ -279,7 +279,7 @@ def doSignaleAbsenceGrSemestre( """ moduleimpl_id = moduleimpl_id or None if etudids: - etudids = etudids.split(",") + etudids = [int(x) for x in str(etudids).split(",")] else: etudids = [] if dates: @@ -1480,7 +1480,11 @@ def ProcessBilletAbsenceForm(billet_id, REQUEST=None): def XMLgetAbsEtud(beg_date="", end_date="", REQUEST=None): """returns list of absences in date interval""" t0 = time.time() - etud = sco_etud.get_etud_info(filled=False)[0] + etuds = sco_etud.get_etud_info(filled=False) + if not etuds: + raise APIInvalidParams("étudiant inconnu") + # raise ScoValueError("étudiant inconnu") + etud = etuds[0] exp = re.compile(r"^(\d{4})\D?(0[1-9]|1[0-2])\D?([12]\d|0[1-9]|3[01])$") if not exp.match(beg_date): raise ScoValueError("invalid date: %s" % beg_date) @@ -1501,7 +1505,7 @@ def XMLgetAbsEtud(beg_date="", end_date="", REQUEST=None): begin=a["begin"], end=a["end"], description=a["description"], - justified=int(a["estjust"]), + justified=str(int(a["estjust"])), ) ) log("XMLgetAbsEtud (%gs)" % (time.time() - t0))