2022-05-11 00:59:51 +02:00
|
|
|
##############################################################################
|
|
|
|
# ScoDoc
|
|
|
|
# Copyright (c) 1999 - 2022 Emmanuel Viennet. All rights reserved.
|
|
|
|
# See LICENSE
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
"""
|
|
|
|
API : accès aux étudiants
|
|
|
|
"""
|
2022-04-20 15:50:02 +02:00
|
|
|
|
2022-05-23 15:46:36 +02:00
|
|
|
from flask import jsonify, make_response
|
2022-03-02 16:45:47 +01:00
|
|
|
|
2022-04-26 13:46:09 +02:00
|
|
|
import app
|
2022-03-02 16:45:47 +01:00
|
|
|
from app.api import bp
|
|
|
|
from app.api.errors import error_response
|
2022-05-03 13:35:17 +02:00
|
|
|
from app.api.auth import token_auth, token_permission_required
|
2022-07-19 22:17:10 +02:00
|
|
|
from app.api import tools
|
2022-05-11 00:59:51 +02:00
|
|
|
from app.models import Departement, FormSemestreInscription, FormSemestre, Identite
|
2022-04-26 13:46:09 +02:00
|
|
|
from app.scodoc import sco_bulletins
|
|
|
|
from app.scodoc import sco_groups
|
2022-05-23 15:46:36 +02:00
|
|
|
from app.scodoc.sco_bulletins import do_formsemestre_bulletinetud
|
2022-03-04 17:16:08 +01:00
|
|
|
from app.scodoc.sco_permissions import Permission
|
2022-07-19 22:17:10 +02:00
|
|
|
from app.scodoc import sco_utils as scu
|
2022-03-02 16:45:47 +01:00
|
|
|
|
|
|
|
|
2022-05-16 15:14:51 +02:00
|
|
|
@bp.route("/etudiants/courants", defaults={"long": False})
|
|
|
|
@bp.route("/etudiants/courants/long", defaults={"long": True})
|
2022-05-03 13:35:17 +02:00
|
|
|
@token_auth.login_required
|
2022-04-14 14:56:36 +02:00
|
|
|
@token_permission_required(Permission.APIView)
|
2022-05-16 15:14:51 +02:00
|
|
|
def etudiants_courants(long=False):
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
2022-05-05 19:50:09 +02:00
|
|
|
Liste des étudiants inscrits dans un formsemestre actuellement en cours.
|
2022-03-02 16:45:47 +01:00
|
|
|
|
|
|
|
Exemple de résultat :
|
2022-05-03 16:15:04 +02:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"id": 1,
|
|
|
|
"nip": 1,
|
2022-03-02 16:45:47 +01:00
|
|
|
"nom": "MOREL",
|
2022-05-03 16:15:04 +02:00
|
|
|
"prenom": "JACQUES",
|
|
|
|
"civilite": "X",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": 2,
|
|
|
|
"nip": 2,
|
|
|
|
"nom": "GILLES",
|
|
|
|
"prenom": "MAXIME",
|
2022-03-02 16:45:47 +01:00
|
|
|
"civilite": "X",
|
2022-05-03 16:15:04 +02:00
|
|
|
},
|
|
|
|
...
|
|
|
|
]
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
2022-04-26 13:46:09 +02:00
|
|
|
etuds = Identite.query.filter(
|
2022-04-26 14:48:43 +02:00
|
|
|
Identite.id == FormSemestreInscription.etudid,
|
|
|
|
FormSemestreInscription.formsemestre_id == FormSemestre.id,
|
|
|
|
FormSemestre.date_debut <= app.db.func.now(),
|
2022-04-26 13:46:09 +02:00
|
|
|
FormSemestre.date_fin >= app.db.func.now(),
|
|
|
|
)
|
2022-04-28 03:24:37 +02:00
|
|
|
if long:
|
|
|
|
data = [etud.to_dict_bul(include_urls=False) for etud in etuds]
|
|
|
|
else:
|
|
|
|
data = [etud.to_dict_short() for etud in etuds]
|
2022-03-02 16:45:47 +01:00
|
|
|
return jsonify(data)
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/etudiant/etudid/<int:etudid>", methods=["GET"])
|
2022-05-07 08:23:30 +02:00
|
|
|
@bp.route("/etudiant/nip/<string:nip>", methods=["GET"])
|
|
|
|
@bp.route("/etudiant/ine/<string:ine>", methods=["GET"])
|
2022-05-03 13:35:17 +02:00
|
|
|
@token_auth.login_required
|
2022-04-14 14:56:36 +02:00
|
|
|
@token_permission_required(Permission.APIView)
|
2022-05-11 00:59:51 +02:00
|
|
|
def etudiant(etudid: int = None, nip: str = None, ine: str = None):
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
2022-05-11 00:59:51 +02:00
|
|
|
Retourne les informations de l'étudiant correspondant, ou 404 si non trouvé.
|
2022-03-02 16:45:47 +01:00
|
|
|
|
2022-05-11 00:59:51 +02:00
|
|
|
etudid : l'etudid de l'étudiant
|
|
|
|
nip : le code nip de l'étudiant
|
|
|
|
ine : le code ine de l'étudiant
|
|
|
|
|
|
|
|
Les codes INE et NIP sont uniques au sein d'un département.
|
|
|
|
Si plusieurs objets ont le même code, on ramène le plus récemment inscrit.
|
2022-03-02 16:45:47 +01:00
|
|
|
|
|
|
|
Exemple de résultat :
|
2022-05-11 00:59:51 +02:00
|
|
|
{
|
|
|
|
"civilite": "X",
|
|
|
|
"code_ine": "1",
|
|
|
|
"code_nip": "1",
|
|
|
|
"date_naissance": "",
|
|
|
|
"email": "SACHA.COSTA@example.com",
|
|
|
|
"emailperso": "",
|
|
|
|
"etudid": 1,
|
|
|
|
"nom": "COSTA",
|
|
|
|
"prenom": "SACHA",
|
|
|
|
"nomprenom": "Sacha COSTA",
|
|
|
|
"lieu_naissance": "",
|
|
|
|
"dept_naissance": "",
|
|
|
|
"nationalite": "",
|
|
|
|
"boursier": "",
|
|
|
|
"id": 1,
|
|
|
|
"codepostaldomicile": "",
|
|
|
|
"paysdomicile": "",
|
|
|
|
"telephonemobile": "",
|
|
|
|
"typeadresse": "domicile",
|
|
|
|
"domicile": "",
|
|
|
|
"villedomicile": "",
|
|
|
|
"telephone": "",
|
|
|
|
"fax": "",
|
|
|
|
"description": ""
|
|
|
|
}
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
2022-07-19 22:17:10 +02:00
|
|
|
etud = tools.get_etud(etudid, nip, ine)
|
2022-05-11 00:59:51 +02:00
|
|
|
|
2022-05-06 09:38:30 +02:00
|
|
|
if etud is None:
|
|
|
|
return error_response(
|
|
|
|
404,
|
2022-05-11 00:59:51 +02:00
|
|
|
message="étudiant inconnu",
|
2022-05-06 09:38:30 +02:00
|
|
|
)
|
2022-03-02 16:45:47 +01:00
|
|
|
|
2022-05-11 00:59:51 +02:00
|
|
|
return jsonify(etud.to_dict_bul(include_urls=False))
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/etudiants/etudid/<int:etudid>", methods=["GET"])
|
|
|
|
@bp.route("/etudiants/nip/<string:nip>", methods=["GET"])
|
|
|
|
@bp.route("/etudiants/ine/<string:ine>", methods=["GET"])
|
|
|
|
@token_auth.login_required
|
|
|
|
@token_permission_required(Permission.APIView)
|
|
|
|
def etudiants(etudid: int = None, nip: str = None, ine: str = None):
|
|
|
|
"""
|
|
|
|
Info sur le ou les étudiants correspondant. Comme /etudiant mais renvoie
|
|
|
|
toujours une liste.
|
|
|
|
Si non trouvé, liste vide, pas d'erreur.
|
|
|
|
Dans 99% des cas, la liste contient un seul étudiant, mais si l'étudiant a
|
|
|
|
été inscrit dans plusieurs départements, on a plusieurs objets (1 par dept.).
|
|
|
|
"""
|
|
|
|
if etudid is not None:
|
|
|
|
query = Identite.query.filter_by(id=etudid)
|
|
|
|
elif nip is not None:
|
|
|
|
query = Identite.query.filter_by(code_nip=nip)
|
|
|
|
elif ine is not None:
|
|
|
|
query = Identite.query.filter_by(code_ine=ine)
|
|
|
|
else:
|
|
|
|
return error_response(
|
|
|
|
404,
|
|
|
|
message="parametre manquant",
|
|
|
|
)
|
|
|
|
|
|
|
|
return jsonify([etud.to_dict_bul(include_urls=False) for etud in query])
|
2022-03-02 16:45:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/etudiant/etudid/<int:etudid>/formsemestres")
|
2022-05-07 08:23:30 +02:00
|
|
|
@bp.route("/etudiant/nip/<string:nip>/formsemestres")
|
|
|
|
@bp.route("/etudiant/ine/<string:ine>/formsemestres")
|
2022-05-03 13:35:17 +02:00
|
|
|
@token_auth.login_required
|
2022-04-14 14:56:36 +02:00
|
|
|
@token_permission_required(Permission.APIView)
|
2022-03-02 16:45:47 +01:00
|
|
|
def etudiant_formsemestres(etudid: int = None, nip: int = None, ine: int = None):
|
|
|
|
"""
|
2022-05-11 00:59:51 +02:00
|
|
|
Liste des semestres qu'un étudiant a suivi, triés par ordre chronologique.
|
2022-07-19 22:17:10 +02:00
|
|
|
Attention, si accès via NIP ou INE, les semestres peuvent être de départements différents
|
|
|
|
(si l'étudiant a changé de département). L'id du département est `dept_id`.
|
|
|
|
|
2022-05-11 00:59:51 +02:00
|
|
|
Accès par etudid, nip ou ine
|
2022-03-02 16:45:47 +01:00
|
|
|
|
|
|
|
Exemple de résultat :
|
2022-05-11 00:59:51 +02:00
|
|
|
[
|
|
|
|
{
|
2022-07-19 22:17:10 +02:00
|
|
|
"block_moyennes": false,
|
|
|
|
"bul_bgcolor": "white",
|
|
|
|
"bul_hide_xml": false,
|
|
|
|
"date_debut_iso": "2021-09-01",
|
|
|
|
"date_debut": "01/09/2021",
|
|
|
|
"date_fin_iso": "2022-08-31",
|
2022-05-11 00:59:51 +02:00
|
|
|
"date_fin": "31/08/2022",
|
|
|
|
"dept_id": 1,
|
2022-07-19 22:17:10 +02:00
|
|
|
"elt_annee_apo": null,
|
|
|
|
"elt_sem_apo": null,
|
2022-05-11 00:59:51 +02:00
|
|
|
"ens_can_edit_eval": false,
|
2022-07-19 22:17:10 +02:00
|
|
|
"etat": true,
|
2022-05-11 00:59:51 +02:00
|
|
|
"formation_id": 1,
|
2022-07-19 22:17:10 +02:00
|
|
|
"formsemestre_id": 1,
|
2022-05-11 00:59:51 +02:00
|
|
|
"gestion_compensation": false,
|
|
|
|
"gestion_semestrielle": false,
|
2022-07-19 22:17:10 +02:00
|
|
|
"id": 1,
|
|
|
|
"modalite": "FI",
|
|
|
|
"resp_can_change_ens": true,
|
|
|
|
"resp_can_edit": false,
|
2022-05-11 00:59:51 +02:00
|
|
|
"responsables": []
|
2022-07-19 22:17:10 +02:00
|
|
|
"scodoc7_id": null,
|
|
|
|
"semestre_id": 1,
|
|
|
|
"titre_num": "Semestre test semestre 1",
|
|
|
|
"titre": "Semestre test",
|
2022-05-11 00:59:51 +02:00
|
|
|
},
|
|
|
|
...
|
|
|
|
]
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
2022-05-11 00:59:51 +02:00
|
|
|
if etudid is not None:
|
|
|
|
query = FormSemestre.query.filter(
|
|
|
|
FormSemestreInscription.etudid == etudid,
|
|
|
|
FormSemestreInscription.formsemestre_id == FormSemestre.id,
|
|
|
|
)
|
|
|
|
elif nip is not None:
|
|
|
|
query = FormSemestre.query.filter(
|
|
|
|
Identite.code_nip == nip,
|
|
|
|
FormSemestreInscription.etudid == Identite.id,
|
|
|
|
FormSemestreInscription.formsemestre_id == FormSemestre.id,
|
|
|
|
)
|
|
|
|
elif ine is not None:
|
|
|
|
query = FormSemestre.query.filter(
|
|
|
|
Identite.code_ine == ine,
|
|
|
|
FormSemestreInscription.etudid == Identite.id,
|
|
|
|
FormSemestreInscription.formsemestre_id == FormSemestre.id,
|
|
|
|
)
|
|
|
|
else:
|
2022-05-06 09:38:30 +02:00
|
|
|
return error_response(
|
|
|
|
404,
|
2022-05-11 00:59:51 +02:00
|
|
|
message="parametre manquant",
|
2022-05-06 09:38:30 +02:00
|
|
|
)
|
2022-03-02 16:45:47 +01:00
|
|
|
|
2022-05-11 00:59:51 +02:00
|
|
|
formsemestres = query.order_by(FormSemestre.date_debut)
|
2022-03-02 16:45:47 +01:00
|
|
|
|
2022-07-05 16:09:26 +02:00
|
|
|
return jsonify(
|
|
|
|
[formsemestre.to_dict(convert_parcours=True) for formsemestre in formsemestres]
|
|
|
|
)
|
2022-03-02 16:45:47 +01:00
|
|
|
|
|
|
|
|
2022-04-25 15:25:45 +02:00
|
|
|
@bp.route(
|
|
|
|
"/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin",
|
|
|
|
methods=["GET"],
|
2022-05-16 15:14:51 +02:00
|
|
|
defaults={"version": "long", "pdf": False},
|
2022-04-25 15:25:45 +02:00
|
|
|
)
|
|
|
|
@bp.route(
|
2022-05-07 08:23:30 +02:00
|
|
|
"/etudiant/nip/<string:nip>/formsemestre/<int:formsemestre_id>/bulletin",
|
2022-04-25 15:25:45 +02:00
|
|
|
methods=["GET"],
|
2022-05-16 15:14:51 +02:00
|
|
|
defaults={"version": "long", "pdf": False},
|
2022-04-25 15:25:45 +02:00
|
|
|
)
|
|
|
|
@bp.route(
|
2022-05-07 08:23:30 +02:00
|
|
|
"/etudiant/ine/<string:ine>/formsemestre/<int:formsemestre_id>/bulletin",
|
2022-04-25 15:25:45 +02:00
|
|
|
methods=["GET"],
|
2022-05-16 15:14:51 +02:00
|
|
|
defaults={"version": "long", "pdf": False},
|
2022-04-25 15:25:45 +02:00
|
|
|
)
|
2022-05-16 15:14:51 +02:00
|
|
|
# Version PDF non fonctionnelle
|
2022-05-19 16:17:27 +02:00
|
|
|
@bp.route(
|
|
|
|
"/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin/pdf",
|
|
|
|
methods=["GET"],
|
|
|
|
defaults={"version": "long", "pdf": True},
|
|
|
|
)
|
2022-05-16 15:14:51 +02:00
|
|
|
# @bp.route(
|
|
|
|
# "/etudiant/nip/<string:nip>/formsemestre/<int:formsemestre_id>/bulletin/pdf",
|
|
|
|
# methods=["GET"],
|
|
|
|
# defaults={"version": "long", "pdf": True},
|
|
|
|
# )
|
|
|
|
# @bp.route(
|
|
|
|
# "/etudiant/ine/<string:ine>/formsemestre/<int:formsemestre_id>/bulletin/pdf",
|
|
|
|
# methods=["GET"],
|
|
|
|
# defaults={"version": "long", "pdf": True},
|
|
|
|
# )
|
2022-05-03 13:35:17 +02:00
|
|
|
@bp.route(
|
|
|
|
"/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin/short",
|
|
|
|
methods=["GET"],
|
2022-05-16 15:14:51 +02:00
|
|
|
defaults={"version": "short", "pdf": False},
|
2022-05-03 13:35:17 +02:00
|
|
|
)
|
|
|
|
@bp.route(
|
2022-05-07 08:23:30 +02:00
|
|
|
"/etudiant/nip/<string:nip>/formsemestre/<int:formsemestre_id>/bulletin/short",
|
2022-05-03 13:35:17 +02:00
|
|
|
methods=["GET"],
|
2022-05-16 15:14:51 +02:00
|
|
|
defaults={"version": "short", "pdf": False},
|
2022-05-03 13:35:17 +02:00
|
|
|
)
|
|
|
|
@bp.route(
|
2022-05-07 08:23:30 +02:00
|
|
|
"/etudiant/ine/<string:ine>/formsemestre/<int:formsemestre_id>/bulletin/short",
|
2022-05-03 13:35:17 +02:00
|
|
|
methods=["GET"],
|
2022-05-16 15:14:51 +02:00
|
|
|
defaults={"version": "short", "pdf": False},
|
2022-05-03 13:35:17 +02:00
|
|
|
)
|
2022-07-19 22:17:10 +02:00
|
|
|
@bp.route(
|
|
|
|
"/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin/short/pdf",
|
|
|
|
methods=["GET"],
|
|
|
|
defaults={"version": "short", "pdf": True},
|
|
|
|
)
|
|
|
|
@bp.route(
|
|
|
|
"/etudiant/nip/<string:nip>/formsemestre/<int:formsemestre_id>/bulletin/short/pdf",
|
|
|
|
methods=["GET"],
|
|
|
|
defaults={"version": "short", "pdf": True},
|
|
|
|
)
|
|
|
|
@bp.route(
|
|
|
|
"/etudiant/ine/<string:ine>/formsemestre/<int:formsemestre_id>/bulletin/short/pdf",
|
|
|
|
methods=["GET"],
|
|
|
|
defaults={"version": "short", "pdf": True},
|
|
|
|
)
|
2022-05-03 13:35:17 +02:00
|
|
|
@token_auth.login_required
|
2022-04-14 14:56:36 +02:00
|
|
|
@token_permission_required(Permission.APIView)
|
2022-05-16 16:04:33 +02:00
|
|
|
def etudiant_bulletin_semestre( # XXX TODO Ajouter la possibilité de retourner en version pdf
|
2022-05-03 13:35:17 +02:00
|
|
|
formsemestre_id,
|
|
|
|
etudid: int = None,
|
2022-05-11 00:59:51 +02:00
|
|
|
nip: str = None,
|
|
|
|
ine: str = None,
|
2022-05-03 13:35:17 +02:00
|
|
|
version="long",
|
2022-05-17 16:07:46 +02:00
|
|
|
pdf: bool = False,
|
2022-04-25 15:25:45 +02:00
|
|
|
):
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
|
|
|
Retourne le bulletin d'un étudiant en fonction de son id et d'un semestre donné
|
|
|
|
|
|
|
|
formsemestre_id : l'id d'un formsemestre
|
|
|
|
etudid : l'etudid d'un étudiant
|
|
|
|
nip : le code nip d'un étudiant
|
|
|
|
ine : le code ine d'un étudiant
|
2022-07-19 22:17:10 +02:00
|
|
|
Exemple de résultat : voir https://scodoc.org/ScoDoc9API/#bulletin
|
|
|
|
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
2022-05-11 00:59:51 +02:00
|
|
|
formsemestre = FormSemestre.query.filter_by(id=formsemestre_id).first_or_404()
|
|
|
|
dept = Departement.query.filter_by(id=formsemestre.dept_id).first_or_404()
|
2022-03-02 16:45:47 +01:00
|
|
|
|
2022-05-11 00:59:51 +02:00
|
|
|
if etudid is not None:
|
|
|
|
query = Identite.query.filter_by(id=etudid)
|
|
|
|
elif nip is not None:
|
|
|
|
query = Identite.query.filter_by(code_nip=nip, dept_id=dept.id)
|
|
|
|
elif ine is not None:
|
|
|
|
query = Identite.query.filter_by(code_ine=ine, dept_id=dept.id)
|
|
|
|
else:
|
|
|
|
return error_response(
|
|
|
|
404,
|
|
|
|
message="parametre manquant",
|
|
|
|
)
|
2022-03-02 16:45:47 +01:00
|
|
|
|
2022-05-11 00:59:51 +02:00
|
|
|
etud = query.first()
|
2022-05-06 09:38:30 +02:00
|
|
|
if etud is None:
|
2022-04-26 14:48:43 +02:00
|
|
|
return error_response(
|
2022-05-06 09:38:30 +02:00
|
|
|
404,
|
|
|
|
message="id de l'étudiant (etudid, nip, ine) inconnu",
|
2022-04-26 14:48:43 +02:00
|
|
|
)
|
2022-05-11 00:59:51 +02:00
|
|
|
|
|
|
|
app.set_sco_dept(dept.acronym)
|
2022-05-19 16:17:27 +02:00
|
|
|
|
|
|
|
if pdf:
|
2022-07-19 22:17:10 +02:00
|
|
|
pdf_response, _ = do_formsemestre_bulletinetud(
|
|
|
|
formsemestre, etudid, version=version, format="pdf"
|
2022-05-23 15:46:36 +02:00
|
|
|
)
|
2022-07-19 22:17:10 +02:00
|
|
|
return pdf_response
|
2022-05-19 16:17:27 +02:00
|
|
|
|
2022-05-06 09:38:30 +02:00
|
|
|
return sco_bulletins.get_formsemestre_bulletin_etud_json(
|
2022-07-05 20:37:38 +02:00
|
|
|
formsemestre, etud, version=version
|
2022-05-06 09:38:30 +02:00
|
|
|
)
|
2022-03-02 16:45:47 +01:00
|
|
|
|
|
|
|
|
2022-04-25 15:25:45 +02:00
|
|
|
@bp.route(
|
2022-05-04 23:11:20 +02:00
|
|
|
"/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/groups",
|
2022-04-25 15:25:45 +02:00
|
|
|
methods=["GET"],
|
|
|
|
)
|
|
|
|
@bp.route(
|
2022-05-07 08:23:30 +02:00
|
|
|
"/etudiant/nip/<string:nip>/formsemestre/<int:formsemestre_id>/groups",
|
|
|
|
methods=["GET"],
|
2022-04-25 15:25:45 +02:00
|
|
|
)
|
|
|
|
@bp.route(
|
2022-05-07 08:23:30 +02:00
|
|
|
"/etudiant/ine/<string:ine>/formsemestre/<int:formsemestre_id>/groups",
|
|
|
|
methods=["GET"],
|
2022-04-25 15:25:45 +02:00
|
|
|
)
|
2022-05-03 13:35:17 +02:00
|
|
|
@token_auth.login_required
|
2022-04-14 14:56:36 +02:00
|
|
|
@token_permission_required(Permission.APIView)
|
2022-04-25 15:25:45 +02:00
|
|
|
def etudiant_groups(
|
|
|
|
formsemestre_id: int, etudid: int = None, nip: int = None, ine: int = None
|
|
|
|
):
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
2022-05-04 23:11:20 +02:00
|
|
|
Retourne la liste des groupes auxquels appartient l'étudiant dans le formsemestre indiqué
|
2022-03-02 16:45:47 +01:00
|
|
|
|
|
|
|
formsemestre_id : l'id d'un formsemestre
|
|
|
|
etudid : l'etudid d'un étudiant
|
|
|
|
nip : le code nip d'un étudiant
|
|
|
|
ine : le code ine d'un étudiant
|
|
|
|
|
|
|
|
Exemple de résultat :
|
2022-05-11 00:59:51 +02:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"partition_id": 1,
|
|
|
|
"id": 1,
|
|
|
|
"formsemestre_id": 1,
|
|
|
|
"partition_name": null,
|
|
|
|
"numero": 0,
|
|
|
|
"bul_show_rank": false,
|
|
|
|
"show_in_lists": true,
|
|
|
|
"group_id": 1,
|
|
|
|
"group_name": null
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"partition_id": 2,
|
|
|
|
"id": 2,
|
|
|
|
"formsemestre_id": 1,
|
|
|
|
"partition_name": "TD",
|
|
|
|
"numero": 1,
|
|
|
|
"bul_show_rank": false,
|
|
|
|
"show_in_lists": true,
|
|
|
|
"group_id": 2,
|
|
|
|
"group_name": "A"
|
|
|
|
}
|
|
|
|
]
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
|
|
|
|
2022-05-11 00:59:51 +02:00
|
|
|
formsemestre = FormSemestre.query.filter_by(id=formsemestre_id).first()
|
|
|
|
if formsemestre is None:
|
|
|
|
return error_response(
|
|
|
|
404,
|
|
|
|
message="formsemestre inconnu",
|
|
|
|
)
|
|
|
|
dept = Departement.query.get(formsemestre.dept_id)
|
|
|
|
if etudid is not None:
|
|
|
|
query = Identite.query.filter_by(id=etudid)
|
|
|
|
elif nip is not None:
|
|
|
|
query = Identite.query.filter_by(code_nip=nip, dept_id=dept.id)
|
|
|
|
elif ine is not None:
|
|
|
|
query = Identite.query.filter_by(code_ine=ine, dept_id=dept.id)
|
|
|
|
else:
|
|
|
|
return error_response(
|
|
|
|
404,
|
|
|
|
message="parametre manquant",
|
|
|
|
)
|
|
|
|
etud = query.first()
|
|
|
|
if etud is None:
|
|
|
|
return error_response(
|
|
|
|
404,
|
|
|
|
message="etudiant inconnu",
|
|
|
|
)
|
2022-04-27 05:34:56 +02:00
|
|
|
app.set_sco_dept(dept.acronym)
|
2022-05-11 00:59:51 +02:00
|
|
|
data = sco_groups.get_etud_groups(etud.id, formsemestre.id)
|
2022-03-02 16:45:47 +01:00
|
|
|
|
2022-04-22 16:22:10 +02:00
|
|
|
return jsonify(data)
|