Compare commits

...

3 Commits

6 changed files with 141 additions and 128 deletions

View File

@ -22,8 +22,6 @@ def requested_format(default_format="json", allowed_formats=None):
from app.api import tokens
from app.api import sco_api
from app.api import test_api
from app.api import departements
from app.api import etudiants
from app.api import formations

View File

@ -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"
},
...
]

View File

@ -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

View File

@ -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é.

View File

@ -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/<int:formsemestre_id>/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

View File

@ -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" """