From cf996e46d0a5aef48ec36b82971437ceba3fa019 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 12 Dec 2021 13:00:30 +0100 Subject: [PATCH] =?UTF-8?q?Acc=C3=A8s=20bulletins=20BUt=20par=20code=5Fnip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/notes.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/views/notes.py b/app/views/notes.py index d0824a108b..98117d3a68 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -285,14 +285,14 @@ def formsemestre_bulletinetud( prefer_mail_perso=False, code_nip=None, ): - if not (etudid or code_nip): - raise ScoValueError("Paramètre manquant: spécifier code_nip ou etudid") - if not formsemestre_id: - raise ScoValueError("Paramètre manquant: formsemestre_id est requis") - formsemestre = FormSemestre.query.get_or_404(formsemestre_id) if formsemestre.formation.is_apc(): - etud = models.Identite.query.get_or_404(etudid) + if etudid: + etud = models.Identite.query.get_or_404(etudid) + elif code_nip: + etud = models.Identite.query.filter_by( + code_nip=str(code_nip) + ).first_or_404() if format == "json": r = bulletin_but.ResultatsSemestreBUT(formsemestre) return jsonify(r.bulletin_etud(etud, formsemestre)) @@ -310,6 +310,8 @@ def formsemestre_bulletinetud( sco=ScoData(), ) + if not (etudid or code_nip): + raise ScoValueError("Paramètre manquant: spécifier code_nip ou etudid") return sco_bulletins.formsemestre_bulletinetud( etudid=etudid, formsemestre_id=formsemestre_id,