1
0
forked from ScoDoc/ScoDoc

fixe du format de retour de etudiant_formsemestre et formsemestre

This commit is contained in:
leonard_montalbano 2022-05-02 09:38:41 +02:00
parent aba6330065
commit bac99da726
2 changed files with 159 additions and 41 deletions

View File

@ -111,36 +111,34 @@ def etudiant_formsemestres(etudid: int = None, nip: int = None, ine: int = None)
Exemple de résultat : Exemple de résultat :
[ [
{ {
"titre": "master machine info", "date_fin": "31/08/2022",
"gestion_semestrielle": false, "resp_can_edit": false,
"date_debut": "01/09/2021", "dept_id": 1,
"bul_bgcolor": null, "etat": true,
"date_fin": "15/12/2022", "resp_can_change_ens": true,
"resp_can_edit": false, "id": 1,
"dept_id": 1, "modalite": "FI",
"etat": true, "ens_can_edit_eval": false,
"resp_can_change_ens": false, "formation_id": 1,
"id": 1, "gestion_compensation": false,
"modalite": "FI", "elt_sem_apo": null,
"ens_can_edit_eval": false, "semestre_id": 1,
"formation_id": 1, "bul_hide_xml": false,
"gestion_compensation": false, "elt_annee_apo": null,
"elt_sem_apo": null, "titre": "Semestre test",
"semestre_id": 1, "block_moyennes": false,
"bul_hide_xml": false, "scodoc7_id": null,
"elt_annee_apo": null, "date_debut": "01/09/2021",
"block_moyennes": false, "gestion_semestrielle": false,
"formsemestre_id": 1, "bul_bgcolor": "white",
"titre_num": "master machine info semestre 1", "formsemestre_id": 1,
"date_debut_iso": "2021-09-01", "titre_num": "Semestre test semestre 1",
"date_fin_iso": "2022-12-15", "date_debut_iso": "2021-09-01",
"responsables": [ "date_fin_iso": "2022-08-31",
3, "responsables": []
2 },
] ...
},
...
] ]
""" """
# Récupération de l'étudiant # Récupération de l'étudiant

View File

@ -107,21 +107,21 @@ def formsemestre_apo(etape_apo: str):
@bp.route( @bp.route(
"/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/etudid/<int:etudid>/bulletin", "/formsemestre/<int:formsemestre_id>/etudiant/etudid/<int:etudid>/bulletin",
methods=["GET"],
)
@bp.route(
"/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/nip/<int:nip>/bulletin",
methods=["GET"],
)
@bp.route(
"/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/ine/<int:ine>/bulletin",
methods=["GET"], methods=["GET"],
) )
# @bp.route(
# "/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/nip/<int:nip>/bulletin",
# methods=["GET"],
# )
# @bp.route(
# "/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/ine/<int:ine>/bulletin",
# methods=["GET"],
# )
@token_permission_required(Permission.APIView) @token_permission_required(Permission.APIView)
def etudiant_bulletin( def etudiant_bulletin(
formsemestre_id, formsemestre_id,
dept, # dept,
etudid: int = None, etudid: int = None,
nip: int = None, nip: int = None,
ine: int = None, ine: int = None,
@ -241,7 +241,15 @@ def etudiant_bulletin(
# Fonction utilisée : app.scodoc.sco_bulletins_json.make_json_formsemestre_bulletinetud() # Fonction utilisée : app.scodoc.sco_bulletins_json.make_json_formsemestre_bulletinetud()
try: try:
app.set_sco_dept(dept) formsemestre = models.FormSemestre.query.filter_by(
id=formsemestre_id
).first_or_404()
dept = models.Departement.query.filter_by(
id=formsemestre.dept_id
).first_or_404()
app.set_sco_dept(dept.acronym)
except: except:
return error_response( return error_response(
409, 409,
@ -499,3 +507,115 @@ def jury(formsemestre_id: int):
# ) # )
return jsonify(data) return jsonify(data)
@bp.route(
"/formsemestre/<int:formsemestre_id>/programme",
methods=["GET"],
)
@token_permission_required(Permission.APIView)
def semestre_index(formsemestre_id: int):
"""
Retourne la liste des Ues, ressources et SAE d'un semestre
dept : l'acronym d'un département
formsemestre_id : l'id d'un formesemestre
Exemple de résultat :
{
"ues": [
{
"type": 0,
"formation_id": 1,
"ue_code": "UCOD11",
"id": 1,
"ects": 12.0,
"acronyme": "RT1.1",
"is_external": false,
"numero": 1,
"code_apogee": "",
"titre": "Administrer les r\u00e9seaux et l\u2019Internet",
"coefficient": 0.0,
"semestre_idx": 1,
"color": "#B80004",
"ue_id": 1
},
...
],
"ressources": [
{
"titre": "Fondamentaux de la programmation",
"coefficient": 1.0,
"module_type": 2,
"id": 17,
"ects": null,
"abbrev": null,
"ue_id": 3,
"code": "R107",
"formation_id": 1,
"heures_cours": 0.0,
"matiere_id": 3,
"heures_td": 0.0,
"semestre_id": 1,
"heures_tp": 0.0,
"numero": 70,
"code_apogee": "",
"module_id": 17
},
...
],
"saes": [
{
"titre": "Se pr\u00e9senter sur Internet",
"coefficient": 1.0,
"module_type": 3,
"id": 14,
"ects": null,
"abbrev": null,
"ue_id": 3,
"code": "SAE14",
"formation_id": 1,
"heures_cours": 0.0,
"matiere_id": 3,
"heures_td": 0.0,
"semestre_id": 1,
"heures_tp": 0.0,
"numero": 40,
"code_apogee": "",
"module_id": 14
},
...
]
}
"""
formsemestre = models.FormSemestre.query.filter_by(
id=formsemestre_id
).first_or_404()
ues = formsemestre.query_ues()
ues_dict = []
ressources = []
saes = []
for ue in ues:
ues_dict.append(ue.to_dict())
ressources = ue.get_ressources()
saes = ue.get_saes()
data_ressources = []
for ressource in ressources:
data_ressources.append(ressource.to_dict())
data_saes = []
for sae in saes:
data_saes.append(sae.to_dict())
data = {
"ues": ues_dict,
"ressources": data_ressources,
"saes": data_saes,
}
return data