2022-05-11 00:59:51 +02:00
|
|
|
##############################################################################
|
|
|
|
# ScoDoc
|
2023-01-02 13:16:27 +01:00
|
|
|
# Copyright (c) 1999 - 2023 Emmanuel Viennet. All rights reserved.
|
2022-05-11 00:59:51 +02:00
|
|
|
# See LICENSE
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
"""
|
|
|
|
API : accès aux étudiants
|
|
|
|
"""
|
2022-10-31 10:12:04 +01:00
|
|
|
from datetime import datetime
|
2022-04-20 15:50:02 +02:00
|
|
|
|
2022-11-27 23:31:48 +01:00
|
|
|
from flask import abort, g, jsonify, request
|
2022-07-24 15:51:13 +02:00
|
|
|
from flask_login import current_user
|
2022-07-27 16:03:14 +02:00
|
|
|
from flask_login import login_required
|
2022-07-29 16:19:40 +02:00
|
|
|
from sqlalchemy import desc, or_
|
2022-03-02 16:45:47 +01:00
|
|
|
|
2022-04-26 13:46:09 +02:00
|
|
|
import app
|
2022-07-27 16:03:14 +02:00
|
|
|
from app.api import api_bp as bp, api_web_bp
|
2022-08-07 19:56:25 +02:00
|
|
|
from app.scodoc.sco_utils import json_error
|
2022-07-19 22:17:10 +02:00
|
|
|
from app.api import tools
|
2022-07-27 16:03:14 +02:00
|
|
|
from app.decorators import scodoc, permission_required
|
2022-07-29 16:19:40 +02:00
|
|
|
from app.models import (
|
|
|
|
Admission,
|
|
|
|
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-03-02 16:45:47 +01:00
|
|
|
|
2022-07-27 16:03:14 +02:00
|
|
|
# Un exemple:
|
2022-08-08 10:06:42 +02:00
|
|
|
# @bp.route("/api_function/<int:arg>")
|
|
|
|
# @api_web_bp.route("/api_function/<int:arg>")
|
|
|
|
# @login_required
|
|
|
|
# @scodoc
|
|
|
|
# @permission_required(Permission.ScoView)
|
|
|
|
# def api_function(arg: int):
|
|
|
|
# """Une fonction quelconque de l'API"""
|
|
|
|
# return jsonify(
|
|
|
|
# {"current_user": current_user.to_dict(), "arg": arg, "dept": g.scodoc_dept}
|
|
|
|
# )
|
2022-07-26 09:00:48 +02: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-07-27 16:03:14 +02:00
|
|
|
@api_web_bp.route("/etudiants/courants", defaults={"long": False})
|
|
|
|
@api_web_bp.route("/etudiants/courants/long", defaults={"long": True})
|
|
|
|
@login_required
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
2022-05-16 15:14:51 +02:00
|
|
|
def etudiants_courants(long=False):
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
2022-07-27 16:03:14 +02:00
|
|
|
La liste des étudiants des semestres "courants" (tous départements)
|
2022-07-24 15:51:13 +02:00
|
|
|
(date du jour comprise dans la période couverte par le sem.)
|
2022-07-27 16:03:14 +02:00
|
|
|
dans lesquels l'utilisateur a la permission ScoView
|
|
|
|
(donc tous si le dept du rôle est None).
|
2022-03-02 16:45:47 +01:00
|
|
|
|
|
|
|
Exemple de résultat :
|
2022-05-03 16:15:04 +02:00
|
|
|
[
|
2022-07-24 15:51:13 +02:00
|
|
|
{
|
|
|
|
"id": 1234,
|
2022-07-29 16:19:40 +02:00
|
|
|
"code_nip": "12345678",
|
|
|
|
"code_ine": null,
|
2022-07-24 15:51:13 +02:00
|
|
|
"nom": "JOHN",
|
|
|
|
"nom_usuel": None,
|
|
|
|
"prenom": "DEUF",
|
|
|
|
"civilite": "M",
|
|
|
|
}
|
2022-05-03 16:15:04 +02:00
|
|
|
...
|
|
|
|
]
|
2022-07-24 15:51:13 +02:00
|
|
|
|
2022-07-31 21:44:39 +02:00
|
|
|
En format "long": voir documentation.
|
|
|
|
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
2022-07-27 16:03:14 +02:00
|
|
|
allowed_depts = current_user.get_depts_with_permission(Permission.ScoView)
|
2022-11-01 11:19:28 +01:00
|
|
|
date_courante = request.args.get("date_courante")
|
|
|
|
if date_courante:
|
|
|
|
test_date = datetime.fromisoformat(date_courante)
|
2022-10-31 10:12:04 +01:00
|
|
|
else:
|
|
|
|
test_date = app.db.func.now()
|
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,
|
2022-10-31 10:12:04 +01:00
|
|
|
FormSemestre.date_debut <= test_date,
|
|
|
|
FormSemestre.date_fin >= test_date,
|
2022-04-26 13:46:09 +02:00
|
|
|
)
|
2022-07-24 15:51:13 +02:00
|
|
|
if not None in allowed_depts:
|
|
|
|
# restreint aux départements autorisés:
|
|
|
|
etuds = etuds.join(Departement).filter(
|
|
|
|
or_(Departement.acronym == acronym for acronym in allowed_depts)
|
|
|
|
)
|
2022-04-28 03:24:37 +02:00
|
|
|
if long:
|
2022-07-31 21:44:39 +02:00
|
|
|
data = [etud.to_dict_api() for etud in etuds]
|
2022-04-28 03:24:37 +02:00
|
|
|
else:
|
|
|
|
data = [etud.to_dict_short() for etud in etuds]
|
2022-03-02 16:45:47 +01:00
|
|
|
return jsonify(data)
|
|
|
|
|
|
|
|
|
2022-07-27 16:03:14 +02:00
|
|
|
@bp.route("/etudiant/etudid/<int:etudid>")
|
|
|
|
@bp.route("/etudiant/nip/<string:nip>")
|
|
|
|
@bp.route("/etudiant/ine/<string:ine>")
|
|
|
|
@api_web_bp.route("/etudiant/etudid/<int:etudid>")
|
|
|
|
@api_web_bp.route("/etudiant/nip/<string:nip>")
|
|
|
|
@api_web_bp.route("/etudiant/ine/<string:ine>")
|
|
|
|
@login_required
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
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
|
|
|
"""
|
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:
|
2022-08-07 19:56:25 +02:00
|
|
|
return json_error(
|
2022-05-06 09:38:30 +02:00
|
|
|
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-07-31 21:44:39 +02:00
|
|
|
return jsonify(etud.to_dict_api())
|
2022-05-11 00:59:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/etudiants/etudid/<int:etudid>", methods=["GET"])
|
|
|
|
@bp.route("/etudiants/nip/<string:nip>", methods=["GET"])
|
|
|
|
@bp.route("/etudiants/ine/<string:ine>", methods=["GET"])
|
2022-07-27 16:03:14 +02:00
|
|
|
@api_web_bp.route("/etudiants/etudid/<int:etudid>", methods=["GET"])
|
|
|
|
@api_web_bp.route("/etudiants/nip/<string:nip>", methods=["GET"])
|
|
|
|
@api_web_bp.route("/etudiants/ine/<string:ine>", methods=["GET"])
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
2022-05-11 00:59:51 +02:00
|
|
|
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.).
|
|
|
|
"""
|
2022-07-27 16:03:14 +02:00
|
|
|
allowed_depts = current_user.get_depts_with_permission(Permission.ScoView)
|
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)
|
|
|
|
elif ine is not None:
|
|
|
|
query = Identite.query.filter_by(code_ine=ine)
|
|
|
|
else:
|
2022-08-07 19:56:25 +02:00
|
|
|
return json_error(
|
2022-05-11 00:59:51 +02:00
|
|
|
404,
|
|
|
|
message="parametre manquant",
|
|
|
|
)
|
2022-07-26 09:00:48 +02:00
|
|
|
if not None in allowed_depts:
|
|
|
|
# restreint aux départements autorisés:
|
|
|
|
etuds = etuds.join(Departement).filter(
|
|
|
|
or_(Departement.acronym == acronym for acronym in allowed_depts)
|
|
|
|
)
|
2022-07-31 21:44:39 +02:00
|
|
|
return jsonify([etud.to_dict_api() 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-07-27 16:03:14 +02:00
|
|
|
@api_web_bp.route("/etudiant/etudid/<int:etudid>/formsemestres")
|
|
|
|
@api_web_bp.route("/etudiant/nip/<string:nip>/formsemestres")
|
|
|
|
@api_web_bp.route("/etudiant/ine/<string:ine>/formsemestres")
|
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
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-27 16:03:14 +02:00
|
|
|
Accès par etudid, nip ou ine.
|
2022-07-19 22:17:10 +02:00
|
|
|
|
2022-07-27 16:03:14 +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`.
|
|
|
|
|
|
|
|
Si accès par département, ne retourne que les formsemestre suivis dans le département.
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
2022-05-11 00:59:51 +02:00
|
|
|
if etudid is not None:
|
2022-07-29 16:19:40 +02:00
|
|
|
q_etud = Identite.query.filter_by(id=etudid)
|
2022-05-11 00:59:51 +02:00
|
|
|
elif nip is not None:
|
2022-07-29 16:19:40 +02:00
|
|
|
q_etud = Identite.query.filter_by(code_nip=nip)
|
2022-05-11 00:59:51 +02:00
|
|
|
elif ine is not None:
|
2022-07-29 16:19:40 +02:00
|
|
|
q_etud = Identite.query.filter_by(code_ine=ine)
|
2022-05-11 00:59:51 +02:00
|
|
|
else:
|
2022-08-07 19:56:25 +02:00
|
|
|
return json_error(404, message="parametre manquant")
|
2022-07-29 16:19:40 +02:00
|
|
|
if g.scodoc_dept is not None:
|
|
|
|
q_etud = q_etud.filter_by(dept_id=g.scodoc_dept_id)
|
|
|
|
etud = q_etud.join(Admission).order_by(desc(Admission.annee)).first()
|
|
|
|
if etud is None:
|
2022-08-07 19:56:25 +02:00
|
|
|
return json_error(404, message="etudiant inexistant")
|
2022-07-29 16:19:40 +02:00
|
|
|
query = FormSemestre.query.filter(
|
|
|
|
FormSemestreInscription.etudid == etud.id,
|
|
|
|
FormSemestreInscription.formsemestre_id == FormSemestre.id,
|
|
|
|
)
|
2022-07-27 16:03:14 +02:00
|
|
|
if g.scodoc_dept is not None:
|
|
|
|
query = query.filter_by(dept_id=g.scodoc_dept_id)
|
|
|
|
|
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-27 17:42:58 +02:00
|
|
|
return jsonify([formsemestre.to_dict_api() for formsemestre in formsemestres])
|
2022-03-02 16:45:47 +01:00
|
|
|
|
|
|
|
|
2022-04-25 15:25:45 +02:00
|
|
|
@bp.route(
|
2022-11-27 23:31:48 +01:00
|
|
|
"/etudiant/<string:code_type>/<string:code>/formsemestre/<int:formsemestre_id>/bulletin",
|
2022-07-19 22:17:10 +02:00
|
|
|
)
|
|
|
|
@bp.route(
|
2022-11-27 23:31:48 +01:00
|
|
|
"/etudiant/<string:code_type>/<string:code>/formsemestre/<int:formsemestre_id>/bulletin/<string:version>",
|
2022-07-19 22:17:10 +02:00
|
|
|
)
|
2022-08-18 15:53:26 +02:00
|
|
|
@bp.route(
|
2022-11-27 23:31:48 +01:00
|
|
|
"/etudiant/<string:code_type>/<string:code>/formsemestre/<int:formsemestre_id>/bulletin/<string:version>/pdf",
|
|
|
|
defaults={"pdf": True},
|
2022-07-27 16:03:14 +02:00
|
|
|
)
|
2023-02-15 16:15:53 +01:00
|
|
|
@bp.route(
|
|
|
|
"/etudiant/<string:code_type>/<string:code>/formsemestre/<int:formsemestre_id>/bulletin/<string:version>/pdf/nosig",
|
|
|
|
defaults={"pdf": True, "with_img_signatures_pdf": False},
|
|
|
|
)
|
2022-07-27 16:03:14 +02:00
|
|
|
@api_web_bp.route(
|
2022-11-27 23:31:48 +01:00
|
|
|
"/etudiant/<string:code_type>/<string:code>/formsemestre/<int:formsemestre_id>/bulletin",
|
2022-07-27 16:03:14 +02:00
|
|
|
)
|
|
|
|
@api_web_bp.route(
|
2022-11-27 23:31:48 +01:00
|
|
|
"/etudiant/<string:code_type>/<string:code>/formsemestre/<int:formsemestre_id>/bulletin/<string:version>",
|
2022-07-27 16:03:14 +02:00
|
|
|
)
|
|
|
|
@api_web_bp.route(
|
2022-11-27 23:31:48 +01:00
|
|
|
"/etudiant/<string:code_type>/<string:code>/formsemestre/<int:formsemestre_id>/bulletin/<string:version>/pdf",
|
|
|
|
defaults={"pdf": True},
|
2022-07-27 16:03:14 +02:00
|
|
|
)
|
2023-02-15 16:15:53 +01:00
|
|
|
@api_web_bp.route(
|
|
|
|
"/etudiant/<string:code_type>/<string:code>/formsemestre/<int:formsemestre_id>/bulletin/<string:version>/pdf/nosig",
|
|
|
|
defaults={"pdf": True, "with_img_signatures_pdf": False},
|
|
|
|
)
|
2022-07-27 16:03:14 +02:00
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
2022-11-27 23:31:48 +01:00
|
|
|
def bulletin(
|
|
|
|
code_type: str = "etudid",
|
|
|
|
code: str = None,
|
|
|
|
formsemestre_id: int = None,
|
|
|
|
version: str = "long",
|
2022-05-17 16:07:46 +02:00
|
|
|
pdf: bool = False,
|
2023-02-15 16:15:53 +01:00
|
|
|
with_img_signatures_pdf: bool = True,
|
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
|
2022-11-27 23:31:48 +01:00
|
|
|
code_type : "etudid", "nip" ou "ine"
|
|
|
|
code : valeur du code INE, NIP ou etudid, selon code_type.
|
|
|
|
version : type de bulletin (par défaut, "long"): short, long, long_mat
|
|
|
|
pdf : si spécifié, bulletin au format PDF (et non JSON).
|
2022-07-19 22:17:10 +02:00
|
|
|
|
2022-11-27 23:31:48 +01:00
|
|
|
Exemple de résultat : voir https://scodoc.org/ScoDoc9API/#bulletin
|
2022-03-02 16:45:47 +01:00
|
|
|
"""
|
2022-11-27 23:31:48 +01:00
|
|
|
if version == "pdf":
|
|
|
|
version = "long"
|
|
|
|
pdf = True
|
|
|
|
# return f"{code_type}={code}, version={version}, pdf={pdf}"
|
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-08-30 16:48:10 +02:00
|
|
|
if g.scodoc_dept and dept.acronym != g.scodoc_dept:
|
2023-02-22 02:13:06 +01:00
|
|
|
return json_error(404, "formsemestre inexistant")
|
2022-11-27 23:31:48 +01:00
|
|
|
app.set_sco_dept(dept.acronym)
|
|
|
|
|
|
|
|
if code_type == "nip":
|
|
|
|
query = Identite.query.filter_by(code_nip=code, dept_id=dept.id)
|
|
|
|
elif code_type == "etudid":
|
|
|
|
try:
|
|
|
|
etudid = int(code)
|
|
|
|
except ValueError:
|
|
|
|
return json_error(404, "invalid etudid type")
|
2022-05-11 00:59:51 +02:00
|
|
|
query = Identite.query.filter_by(id=etudid)
|
2022-11-27 23:31:48 +01:00
|
|
|
elif code_type == "ine":
|
|
|
|
query = Identite.query.filter_by(code_ine=code, dept_id=dept.id)
|
2022-05-11 00:59:51 +02:00
|
|
|
else:
|
2022-11-27 23:31:48 +01:00
|
|
|
return json_error(404, "invalid code_type")
|
2022-05-11 00:59:51 +02:00
|
|
|
etud = query.first()
|
2022-05-06 09:38:30 +02:00
|
|
|
if etud is None:
|
2022-08-07 19:56:25 +02:00
|
|
|
return json_error(404, message="etudiant inexistant")
|
2022-05-19 16:17:27 +02:00
|
|
|
if pdf:
|
2022-07-19 22:17:10 +02:00
|
|
|
pdf_response, _ = do_formsemestre_bulletinetud(
|
2023-02-15 16:15:53 +01:00
|
|
|
formsemestre,
|
|
|
|
etud.id,
|
|
|
|
version=version,
|
|
|
|
format="pdf",
|
|
|
|
with_img_signatures_pdf=with_img_signatures_pdf,
|
2022-05-23 15:46:36 +02:00
|
|
|
)
|
2022-07-19 22:17:10 +02:00
|
|
|
return pdf_response
|
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"],
|
|
|
|
)
|
2022-07-27 16:03:14 +02:00
|
|
|
@scodoc
|
|
|
|
@permission_required(Permission.ScoView)
|
|
|
|
def etudiant_groups(formsemestre_id: int, etudid: 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
|
|
|
|
|
|
|
|
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-07-27 16:03:14 +02:00
|
|
|
query = FormSemestre.query.filter_by(id=formsemestre_id)
|
|
|
|
if g.scodoc_dept:
|
|
|
|
query = query.filter_by(dept_id=g.scodoc_dept_id)
|
|
|
|
formsemestre = query.first()
|
2022-05-11 00:59:51 +02:00
|
|
|
if formsemestre is None:
|
2022-08-07 19:56:25 +02:00
|
|
|
return json_error(
|
2022-05-11 00:59:51 +02:00
|
|
|
404,
|
|
|
|
message="formsemestre inconnu",
|
|
|
|
)
|
2022-07-27 16:03:14 +02:00
|
|
|
dept = formsemestre.departement
|
|
|
|
etud = Identite.query.filter_by(id=etudid, dept_id=dept.id).first_or_404(etudid)
|
|
|
|
|
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)
|