1
0
forked from ScoDoc/ScoDoc

Fix: bul. DUT en json avec accès par NIP

This commit is contained in:
Emmanuel Viennet 2022-03-14 15:30:51 +01:00
parent 204ee4a02b
commit e02a324165
2 changed files with 21 additions and 22 deletions

View File

@ -791,7 +791,7 @@ def etud_descr_situation_semestre(
# ------ Page bulletin # ------ Page bulletin
def formsemestre_bulletinetud( def formsemestre_bulletinetud(
etudid=None, etud: Identite = None,
formsemestre_id=None, formsemestre_id=None,
format=None, format=None,
version="long", version="long",
@ -801,14 +801,13 @@ def formsemestre_bulletinetud(
): ):
"page bulletin de notes" "page bulletin de notes"
format = format or "html" format = format or "html"
etud: Identite = Identite.query.get_or_404(etudid)
formsemestre: FormSemestre = FormSemestre.query.get(formsemestre_id) formsemestre: FormSemestre = FormSemestre.query.get(formsemestre_id)
if not formsemestre: if not formsemestre:
raise ScoValueError(f"semestre {formsemestre_id} inconnu !") raise ScoValueError(f"semestre {formsemestre_id} inconnu !")
bulletin = do_formsemestre_bulletinetud( bulletin = do_formsemestre_bulletinetud(
formsemestre, formsemestre,
etudid, etud.id,
format=format, format=format,
version=version, version=version,
xml_with_decisions=xml_with_decisions, xml_with_decisions=xml_with_decisions,

View File

@ -291,7 +291,6 @@ def formsemestre_bulletinetud(
if not isinstance(formsemestre_id, int): if not isinstance(formsemestre_id, int):
raise ScoInvalidIdType("formsemestre_id must be an integer !") raise ScoInvalidIdType("formsemestre_id must be an integer !")
formsemestre = FormSemestre.query.get_or_404(formsemestre_id) formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
if formsemestre.formation.is_apc() and format != "oldjson":
if etudid: if etudid:
etud = models.Identite.query.get_or_404(etudid) etud = models.Identite.query.get_or_404(etudid)
elif code_nip: elif code_nip:
@ -308,8 +307,9 @@ def formsemestre_bulletinetud(
) )
else: else:
raise ScoValueError( raise ScoValueError(
"Paramètre manquant: spécifier code_nip ou etudid ou code_ine" "Paramètre manquant: spécifier etudid, code_nip ou code_ine"
) )
if formsemestre.formation.is_apc() and format != "oldjson":
if format == "json": if format == "json":
r = bulletin_but.BulletinBUT(formsemestre) r = bulletin_but.BulletinBUT(formsemestre)
return jsonify( return jsonify(
@ -354,7 +354,7 @@ def formsemestre_bulletinetud(
if format == "oldjson": if format == "oldjson":
format = "json" format = "json"
return sco_bulletins.formsemestre_bulletinetud( return sco_bulletins.formsemestre_bulletinetud(
etudid=etudid, etud,
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
format=format, format=format,
version=version, version=version,