2022-04-22 16:22:10 +02:00
|
|
|
from app import models
|
|
|
|
|
2022-05-11 16:17:43 +02:00
|
|
|
### TODO Faire en sorte de renvoyer l'étudiant qui a son inscription la plus récente
|
2022-05-09 16:26:23 +02:00
|
|
|
def get_etud_from_etudid_or_nip_or_ine(
|
|
|
|
etudid=None, nip=None, ine=None
|
|
|
|
) -> models.Identite:
|
2022-04-22 16:22:10 +02:00
|
|
|
"""
|
2022-05-09 16:26:23 +02:00
|
|
|
etudiant en fonction de l'etudid, code nip et code ine rentré en paramètres
|
2022-04-22 16:22:10 +02:00
|
|
|
|
|
|
|
etudid : None ou un int etudid
|
|
|
|
nip : None ou un int code_nip
|
|
|
|
ine : None ou un int code_ine
|
|
|
|
|
2022-05-09 16:26:23 +02:00
|
|
|
Return None si étudiant inexistant.
|
2022-04-22 16:22:10 +02:00
|
|
|
"""
|
|
|
|
if etudid is None:
|
2022-04-25 15:25:45 +02:00
|
|
|
if nip is None: # si ine
|
2022-04-26 13:46:09 +02:00
|
|
|
etud = models.Identite.query.filter_by(code_ine=str(ine)).first()
|
2022-04-25 15:25:45 +02:00
|
|
|
else: # si nip
|
2022-04-26 13:46:09 +02:00
|
|
|
etud = models.Identite.query.filter_by(code_nip=str(nip)).first()
|
2022-04-25 15:25:45 +02:00
|
|
|
else: # si etudid
|
2022-04-26 13:46:09 +02:00
|
|
|
etud = models.Identite.query.filter_by(id=etudid).first()
|
2022-04-22 16:22:10 +02:00
|
|
|
|
2022-04-26 13:46:09 +02:00
|
|
|
return etud
|