1
0
forked from ScoDoc/ScoDoc

2 bugs: XMLgetAbsEtud, doSignaleAbsenceGrSemestre

This commit is contained in:
Emmanuel Viennet 2021-09-13 09:55:49 +02:00
parent da204f5df8
commit 3527d2bba1

View File

@ -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))