forked from ScoDoc/ScoDoc
API: ajout /formsemestres/query?nip=xxxx
This commit is contained in:
parent
3bae99c5cd
commit
0f6824da37
@ -22,6 +22,8 @@ from app.models import (
|
|||||||
Evaluation,
|
Evaluation,
|
||||||
FormSemestre,
|
FormSemestre,
|
||||||
FormSemestreEtape,
|
FormSemestreEtape,
|
||||||
|
FormSemestreInscription,
|
||||||
|
Identite,
|
||||||
ModuleImpl,
|
ModuleImpl,
|
||||||
NotesNotes,
|
NotesNotes,
|
||||||
)
|
)
|
||||||
@ -95,11 +97,14 @@ def formsemestres_query():
|
|||||||
annee_scolaire : année de début de l'année scolaire
|
annee_scolaire : année de début de l'année scolaire
|
||||||
dept_acronym : acronyme du département (eg "RT")
|
dept_acronym : acronyme du département (eg "RT")
|
||||||
dept_id : id du département
|
dept_id : id du département
|
||||||
|
ine ou nip: code d'un étudiant: ramène alors tous les semestres auxquels il est inscrit.
|
||||||
"""
|
"""
|
||||||
etape_apo = request.args.get("etape_apo")
|
etape_apo = request.args.get("etape_apo")
|
||||||
annee_scolaire = request.args.get("annee_scolaire")
|
annee_scolaire = request.args.get("annee_scolaire")
|
||||||
dept_acronym = request.args.get("dept_acronym")
|
dept_acronym = request.args.get("dept_acronym")
|
||||||
dept_id = request.args.get("dept_id")
|
dept_id = request.args.get("dept_id")
|
||||||
|
nip = request.args.get("nip")
|
||||||
|
ine = request.args.get("nip")
|
||||||
formsemestres = FormSemestre.query
|
formsemestres = FormSemestre.query
|
||||||
if g.scodoc_dept:
|
if g.scodoc_dept:
|
||||||
formsemestres = formsemestres.filter_by(dept_id=g.scodoc_dept_id)
|
formsemestres = formsemestres.filter_by(dept_id=g.scodoc_dept_id)
|
||||||
@ -125,7 +130,18 @@ def formsemestres_query():
|
|||||||
formsemestres = formsemestres.join(FormSemestreEtape).filter(
|
formsemestres = formsemestres.join(FormSemestreEtape).filter(
|
||||||
FormSemestreEtape.etape_apo == etape_apo
|
FormSemestreEtape.etape_apo == etape_apo
|
||||||
)
|
)
|
||||||
|
if nip is not None:
|
||||||
|
formsemestres = (
|
||||||
|
formsemestres.join(FormSemestreInscription)
|
||||||
|
.join(Identite)
|
||||||
|
.filter_by(code_nip=nip)
|
||||||
|
)
|
||||||
|
if ine is not None:
|
||||||
|
formsemestres = (
|
||||||
|
formsemestres.join(FormSemestreInscription)
|
||||||
|
.join(Identite)
|
||||||
|
.filter_by(code_ine=ine)
|
||||||
|
)
|
||||||
return jsonify([formsemestre.to_dict_api() for formsemestre in formsemestres])
|
return jsonify([formsemestre.to_dict_api() for formsemestre in formsemestres])
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user