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

View File

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