Bulletins: vérification plus stricte des arguments
This commit is contained in:
parent
4921d45129
commit
9d72954cc1
@ -148,12 +148,15 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"):
|
|||||||
I["server_name"] = request.url_root
|
I["server_name"] = request.url_root
|
||||||
|
|
||||||
# Formation et parcours
|
# Formation et parcours
|
||||||
|
formation_dict = None
|
||||||
if I["sem"]["formation_id"]:
|
if I["sem"]["formation_id"]:
|
||||||
I["formation"] = sco_formations.formation_list(
|
formation_dicts = sco_formations.formation_list(
|
||||||
args={"formation_id": I["sem"]["formation_id"]}
|
args={"formation_id": I["sem"]["formation_id"]}
|
||||||
)[0]
|
)
|
||||||
else: # what's the fuck ?
|
if formation_dicts:
|
||||||
I["formation"] = {
|
formation_dict = formation_dicts[0]
|
||||||
|
if formation_dict is None: # what's the fuck ?
|
||||||
|
formation_dict = {
|
||||||
"acronyme": "?",
|
"acronyme": "?",
|
||||||
"code_specialite": "",
|
"code_specialite": "",
|
||||||
"dept_id": 1,
|
"dept_id": 1,
|
||||||
@ -166,6 +169,7 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"):
|
|||||||
"type_parcours": 0,
|
"type_parcours": 0,
|
||||||
"version": 0,
|
"version": 0,
|
||||||
}
|
}
|
||||||
|
I["formation"] = formation_dict
|
||||||
I["parcours"] = sco_codes_parcours.get_parcours_from_code(
|
I["parcours"] = sco_codes_parcours.get_parcours_from_code(
|
||||||
I["formation"]["type_parcours"]
|
I["formation"]["type_parcours"]
|
||||||
)
|
)
|
||||||
|
@ -299,21 +299,21 @@ def formsemestre_bulletinetud(
|
|||||||
raise ScoInvalidIdType(
|
raise ScoInvalidIdType(
|
||||||
"formsemestre_bulletinetud: formsemestre_id must be an integer !"
|
"formsemestre_bulletinetud: formsemestre_id must be an integer !"
|
||||||
)
|
)
|
||||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
formsemestre = FormSemestre.query.filter_by(
|
||||||
|
formsemestre_id=formsemestre_id, dept_id=g.scodoc_dept_id
|
||||||
|
).first_or_404()
|
||||||
if etudid:
|
if etudid:
|
||||||
etud = models.Identite.query.get_or_404(etudid)
|
etud = models.Identite.query.filter_by(
|
||||||
|
etudid=etudid, dept_id=formsemestre.dept_id
|
||||||
|
).first_or_404()
|
||||||
elif code_nip:
|
elif code_nip:
|
||||||
etud = (
|
etud = models.Identite.query.filter_by(
|
||||||
models.Identite.query.filter_by(code_nip=str(code_nip))
|
code_nip=str(code_nip), dept_id=formsemestre.dept_id
|
||||||
.filter_by(dept_id=formsemestre.dept_id)
|
).first_or_404()
|
||||||
.first_or_404()
|
|
||||||
)
|
|
||||||
elif code_ine:
|
elif code_ine:
|
||||||
etud = (
|
etud = models.Identite.query.filter_by(
|
||||||
models.Identite.query.filter_by(code_ine=str(code_ine))
|
code_ine=str(code_ine), dept_id=formsemestre.dept_id
|
||||||
.filter_by(dept_id=formsemestre.dept_id)
|
).first_or_404()
|
||||||
.first_or_404()
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
raise ScoValueError(
|
raise ScoValueError(
|
||||||
"Paramètre manquant: spécifier etudid, code_nip ou code_ine"
|
"Paramètre manquant: spécifier etudid, code_nip ou code_ine"
|
||||||
|
Loading…
Reference in New Issue
Block a user