From 2cc1ab13d37c56d0eaccc58c7fae46b2d0e2ad06 Mon Sep 17 00:00:00 2001 From: leonard_montalbano Date: Thu, 5 May 2022 14:30:43 +0200 Subject: [PATCH] =?UTF-8?q?sp=C3=A9cification=20des=20exemple=20de=20respo?= =?UTF-8?q?nsables=20+=20changement=20nom=20fonction=20semestre=5Findex=20?= =?UTF-8?q?en=20programme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/departements.py | 55 +++++++------- app/api/etudiants.py | 61 ++++++++-------- app/api/formations.py | 4 +- app/api/formsemestres.py | 146 +++++++++++++++++++------------------ app/models/formsemestre.py | 1 - 5 files changed, 141 insertions(+), 126 deletions(-) diff --git a/app/api/departements.py b/app/api/departements.py index 6da2b90ef..ae8bc775f 100644 --- a/app/api/departements.py +++ b/app/api/departements.py @@ -15,7 +15,7 @@ from app.scodoc.sco_permissions import Permission @token_permission_required(Permission.APIView) def departements(): """ - Retourne la liste des ids de départements visibles + Retourne la liste des départements visibles Exemple de résultat : [ @@ -118,31 +118,34 @@ def liste_semestres_courant(dept: str): [ { "date_fin": "31/08/2022", - "resp_can_edit": false, - "dept_id": 1, - "etat": true, - "resp_can_change_ens": true, - "id": 1, - "modalite": "FI", - "ens_can_edit_eval": false, - "formation_id": 1, - "gestion_compensation": false, - "elt_sem_apo": null, - "semestre_id": 1, - "bul_hide_xml": false, - "elt_annee_apo": null, - "titre": "Semestre test", - "block_moyennes": false, - "scodoc7_id": null, - "date_debut": "01/09/2021", - "gestion_semestrielle": false, - "bul_bgcolor": "white", - "formsemestre_id": 1, - "titre_num": "Semestre test semestre 1", - "date_debut_iso": "2021-09-01", - "date_fin_iso": "2022-08-31", - "responsables": [] - "titre_court": BUT MMI + "resp_can_edit": false, + "dept_id": 1, + "etat": true, + "resp_can_change_ens": true, + "id": 1, + "modalite": "FI", + "ens_can_edit_eval": false, + "formation_id": 1, + "gestion_compensation": false, + "elt_sem_apo": null, + "semestre_id": 1, + "bul_hide_xml": false, + "elt_annee_apo": null, + "titre": "Semestre test", + "block_moyennes": false, + "scodoc7_id": null, + "date_debut": "01/09/2021", + "gestion_semestrielle": false, + "bul_bgcolor": "white", + "formsemestre_id": 1, + "titre_num": "Semestre test semestre 1", + "date_debut_iso": "2021-09-01", + "date_fin_iso": "2022-08-31", + "responsables": [ + 12, + 42 + ], + "titre_court": "BUT MMI" }, ... ] diff --git a/app/api/etudiants.py b/app/api/etudiants.py index 34566e572..042c72b43 100644 --- a/app/api/etudiants.py +++ b/app/api/etudiants.py @@ -120,35 +120,38 @@ def etudiant_formsemestres(etudid: int = None, nip: int = None, ine: int = None) Exemple de résultat : [ - { - "date_fin": "31/08/2022", - "resp_can_edit": false, - "dept_id": 1, - "etat": true, - "resp_can_change_ens": true, - "id": 1, - "modalite": "FI", - "ens_can_edit_eval": false, - "formation_id": 1, - "gestion_compensation": false, - "elt_sem_apo": null, - "semestre_id": 1, - "bul_hide_xml": false, - "elt_annee_apo": null, - "titre": "Semestre test", - "block_moyennes": false, - "scodoc7_id": null, - "date_debut": "01/09/2021", - "gestion_semestrielle": false, - "bul_bgcolor": "white", - "formsemestre_id": 1, - "titre_num": "Semestre test semestre 1", - "date_debut_iso": "2021-09-01", - "date_fin_iso": "2022-08-31", - "responsables": [] - "titre_court": BUT MMI - }, - ... + { + "date_fin": "31/08/2022", + "resp_can_edit": false, + "dept_id": 1, + "etat": true, + "resp_can_change_ens": true, + "id": 1, + "modalite": "FI", + "ens_can_edit_eval": false, + "formation_id": 1, + "gestion_compensation": false, + "elt_sem_apo": null, + "semestre_id": 1, + "bul_hide_xml": false, + "elt_annee_apo": null, + "titre": "Semestre test", + "block_moyennes": false, + "scodoc7_id": null, + "date_debut": "01/09/2021", + "gestion_semestrielle": false, + "bul_bgcolor": "white", + "formsemestre_id": 1, + "titre_num": "Semestre test semestre 1", + "date_debut_iso": "2021-09-01", + "date_fin_iso": "2022-08-31", + "responsables": [ + 12, + 42 + ], + "titre_court": "BUT MMI" + }, + ... ] """ # Récupération de l'étudiant diff --git a/app/api/formations.py b/app/api/formations.py index 3724c96a3..e57f74f7c 100644 --- a/app/api/formations.py +++ b/app/api/formations.py @@ -16,7 +16,7 @@ from app.scodoc.sco_permissions import Permission @token_permission_required(Permission.APIView) def formations_ids(): """ - Retourne la liste de toutes les formations (tous départements) + Retourne la liste de toutes les id de formations (tous départements) Exemple de résultat : [ 17, 99, 32 ] """ @@ -79,6 +79,7 @@ def formation_export_by_formation_id(formation_id: int, export_ids=False): Retourne la formation, avec UE, matières, modules formation_id : l'id d'une formation + export_ids : True ou False, si l'on veut ou non exporter les ids Exemple de résultat : { @@ -294,6 +295,7 @@ def moduleimpls_sem(formsemestre_id: int): def referentiel_competences(formation_id: int): """ Retourne le référentiel de compétences + formation_id : l'id d'une formation return json, ou null si pas de référentiel associé. diff --git a/app/api/formsemestres.py b/app/api/formsemestres.py index 24ec5eeb2..a9116a94b 100644 --- a/app/api/formsemestres.py +++ b/app/api/formsemestres.py @@ -25,38 +25,41 @@ def formsemestre(formsemestre_id: int): Exemple de résultat : { - "date_fin": "31/08/2022", - "resp_can_edit": false, - "dept_id": 1, - "etat": true, - "resp_can_change_ens": true, - "id": 1, - "modalite": "FI", - "ens_can_edit_eval": false, - "formation_id": 1, - "gestion_compensation": false, - "elt_sem_apo": null, - "semestre_id": 1, - "bul_hide_xml": false, - "elt_annee_apo": null, - "titre": "Semestre test", - "block_moyennes": false, - "scodoc7_id": null, - "date_debut": "01/09/2021", - "gestion_semestrielle": false, - "bul_bgcolor": "white", - "formsemestre_id": 1, - "titre_num": "Semestre test semestre 1", - "date_debut_iso": "2021-09-01", - "date_fin_iso": "2022-08-31", - "responsables": [] <<< A DOCUMENTER XXX - } - + "date_fin": "31/08/2022", + "resp_can_edit": false, + "dept_id": 1, + "etat": true, + "resp_can_change_ens": true, + "id": 1, + "modalite": "FI", + "ens_can_edit_eval": false, + "formation_id": 1, + "gestion_compensation": false, + "elt_sem_apo": null, + "semestre_id": 1, + "bul_hide_xml": false, + "elt_annee_apo": null, + "titre": "Semestre test", + "block_moyennes": false, + "scodoc7_id": null, + "date_debut": "01/09/2021", + "gestion_semestrielle": false, + "bul_bgcolor": "white", + "formsemestre_id": 1, + "titre_num": "Semestre test semestre 1", + "date_debut_iso": "2021-09-01", + "date_fin_iso": "2022-08-31", + "responsables": [ + 12, + 42 + ], + "titre_court": "BUT MMI" + } """ formsemestre = models.FormSemestre.query.filter_by( id=formsemestre_id ).first_or_404() - data = formsemestre.to_dict() + data = formsemestre.to_dict_api() return jsonify(data) @@ -70,42 +73,47 @@ def formsemestre_apo(etape_apo: str): etape_apo : un code étape apogée Exemple de résultat : - [ - { - "date_fin": "31/08/2022", - "resp_can_edit": false, - "dept_id": 1, - "etat": true, - "resp_can_change_ens": true, - "id": 1, - "modalite": "FI", - "ens_can_edit_eval": false, - "formation_id": 1, - "gestion_compensation": false, - "elt_sem_apo": null, - "semestre_id": 1, - "bul_hide_xml": false, - "elt_annee_apo": null, - "titre": "Semestre test", - "block_moyennes": false, - "scodoc7_id": null, - "date_debut": "01/09/2021", - "gestion_semestrielle": false, - "bul_bgcolor": "white", - "formsemestre_id": 1, - "titre_num": "Semestre test semestre 1", - "date_debut_iso": "2021-09-01", - "date_fin_iso": "2022-08-31", - "responsables": [] - }, ... - ] + [ + { + "date_fin": "31/08/2022", + "resp_can_edit": false, + "dept_id": 1, + "etat": true, + "resp_can_change_ens": true, + "id": 1, + "modalite": "FI", + "ens_can_edit_eval": false, + "formation_id": 1, + "gestion_compensation": false, + "elt_sem_apo": null, + "semestre_id": 1, + "bul_hide_xml": false, + "elt_annee_apo": null, + "titre": "Semestre test", + "block_moyennes": false, + "scodoc7_id": null, + "date_debut": "01/09/2021", + "gestion_semestrielle": false, + "bul_bgcolor": "white", + "formsemestre_id": 1, + "titre_num": "Semestre test semestre 1", + "date_debut_iso": "2021-09-01", + "date_fin_iso": "2022-08-31", + "responsables": [ + 12, + 42 + ], + "titre_court": "BUT MMI" + }, + ... + ] """ formsemestres = FormSemestre.query.filter( FormSemestreEtape.etape_apo == etape_apo, FormSemestreEtape.formsemestre_id == FormSemestre.id, ) - return jsonify([formsemestre.to_dict() for formsemestre in formsemestres]) + return jsonify([formsemestre.to_dict_api() for formsemestre in formsemestres]) @bp.route("/formsemestre//bulletins", methods=["GET"]) @@ -348,12 +356,12 @@ def bulletins(formsemestre_id: int): # ) # @token_auth.login_required # @token_permission_required(Permission.APIView) -# def semestre_index(formsemestre_id: int): # XXX nom bizarre ?? +# def programme(formsemestre_id: int): # """ # Retourne la liste des Ues, ressources et SAE d'un semestre - +# # formsemestre_id : l'id d'un formsemestre - +# # Exemple de résultat : # { # "ues": [ @@ -421,34 +429,34 @@ def bulletins(formsemestre_id: int): # ] # } # """ - +# # formsemestre: 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 diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index 4831e5892..4095ef5c1 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -395,7 +395,6 @@ class FormSemestre(db.Model): if self.semestre_id == sco_codes_parcours.NO_SEMESTRE_ID: return self.titre return f"{self.titre} {self.formation.get_parcours().SESSION_NAME} {self.semestre_id}" - # return f"{self.formation.acronyme} S{self.semestre_id}" def sem_modalite(self) -> str: """Le semestre et la modalité, ex "S2 FI" ou "S3 APP" """