2021-09-09 12:49:23 +02:00
|
|
|
|
# -*- mode: python -*-
|
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
|
#
|
|
|
|
|
# Gestion scolarite IUT
|
|
|
|
|
#
|
2022-01-01 14:49:42 +01:00
|
|
|
|
# Copyright (c) 1999 - 2022 Emmanuel Viennet. All rights reserved.
|
2021-09-09 12:49:23 +02:00
|
|
|
|
#
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
#
|
|
|
|
|
# Emmanuel Viennet emmanuel.viennet@viennet.net
|
|
|
|
|
#
|
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
|
|
"""API ScoDoc 9
|
|
|
|
|
"""
|
|
|
|
|
# PAS ENCORE IMPLEMENTEE, juste un essai
|
2021-09-09 16:11:05 +02:00
|
|
|
|
# Pour P. Bouron, il faudrait en priorité l'équivalent de
|
2021-10-15 14:00:51 +02:00
|
|
|
|
# Scolarite/Notes/moduleimpl_withmodule_list (alias scodoc7 do_moduleimpl_withmodule_list)
|
2021-09-09 16:11:05 +02:00
|
|
|
|
# Scolarite/Notes/evaluation_create
|
|
|
|
|
# Scolarite/Notes/evaluation_delete
|
|
|
|
|
# Scolarite/Notes/formation_list
|
|
|
|
|
# Scolarite/Notes/formsemestre_list
|
|
|
|
|
# Scolarite/Notes/formsemestre_partition_list
|
|
|
|
|
# Scolarite/Notes/groups_view
|
|
|
|
|
# Scolarite/Notes/moduleimpl_status
|
|
|
|
|
# Scolarite/setGroups
|
2021-12-21 18:49:33 +01:00
|
|
|
|
from datetime import datetime
|
2021-09-09 12:49:23 +02:00
|
|
|
|
|
2021-12-21 18:49:33 +01:00
|
|
|
|
from flask import jsonify, request, g, send_file
|
2021-12-21 00:10:51 +01:00
|
|
|
|
from sqlalchemy.sql import func
|
|
|
|
|
|
|
|
|
|
from app import db, log
|
2021-12-22 00:35:58 +01:00
|
|
|
|
from app.api import bp, requested_format
|
2021-09-09 12:49:23 +02:00
|
|
|
|
from app.api.auth import token_auth
|
2021-12-21 18:49:33 +01:00
|
|
|
|
from app.api.errors import error_response
|
2021-09-09 12:49:23 +02:00
|
|
|
|
from app import models
|
2021-12-21 00:10:51 +01:00
|
|
|
|
from app.models import FormSemestre, FormSemestreInscription, Identite
|
2022-01-08 14:35:02 +01:00
|
|
|
|
from app.models import ApcReferentielCompetences
|
2022-02-23 16:10:10 +01:00
|
|
|
|
from app.scodoc.sco_abs import annule_absence, annule_justif, add_absence, add_justif, list_abs_date
|
2022-02-18 11:26:17 +01:00
|
|
|
|
from app.scodoc.sco_bulletins import formsemestre_bulletinetud_dict
|
|
|
|
|
from app.scodoc.sco_bulletins_json import make_json_formsemestre_bulletinetud
|
2022-02-21 16:12:31 +01:00
|
|
|
|
from app.scodoc.sco_evaluation_db import do_evaluation_get_all_notes
|
2022-02-18 11:26:17 +01:00
|
|
|
|
from app.scodoc.sco_formations import formation_export
|
|
|
|
|
from app.scodoc.sco_formsemestre_inscriptions import do_formsemestre_inscription_listinscrits
|
2022-02-21 16:12:31 +01:00
|
|
|
|
from app.scodoc.sco_groups import setGroups, get_etud_groups, get_group_members
|
2022-02-23 16:10:10 +01:00
|
|
|
|
from app.scodoc.sco_logos import list_logos, find_logo, _list_dept_logos
|
2022-02-18 11:26:17 +01:00
|
|
|
|
from app.scodoc.sco_moduleimpl import moduleimpl_list
|
2021-12-21 00:10:51 +01:00
|
|
|
|
from app.scodoc.sco_permissions import Permission
|
2021-09-09 12:49:23 +02:00
|
|
|
|
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
############################################### Departements ##########################################################
|
2022-02-18 16:08:50 +01:00
|
|
|
|
from app.scodoc.sco_prepajury import feuille_preparation_jury
|
|
|
|
|
from app.scodoc.sco_pvjury import formsemestre_pvjury
|
2022-02-21 16:12:31 +01:00
|
|
|
|
from app.scodoc.sco_recapcomplet import formsemestre_recapcomplet
|
2022-02-24 16:15:41 +01:00
|
|
|
|
from app.scodoc.sco_saisie_notes import notes_add
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/departements", methods=["GET"])
|
2022-03-01 16:00:41 +01:00
|
|
|
|
#@token_auth.login_required
|
2022-01-07 08:49:16 +01:00
|
|
|
|
def departements():
|
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste des ids de départements
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de tous les départements
|
2022-01-07 08:49:16 +01:00
|
|
|
|
depts = models.Departement.query.filter_by(visible=True).all()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
# Mise en place de la liste avec tous les ids de départements
|
2022-01-08 14:35:02 +01:00
|
|
|
|
data = [d.id for d in depts]
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
2022-01-08 14:35:02 +01:00
|
|
|
|
return jsonify(data)
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/departements/<string:dept>/etudiants/liste/<int:sem_id>", methods=["GET"])
|
|
|
|
|
@token_auth.login_required
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def liste_etudiants(dept: str, formsemestre_id=None): # XXX TODO A REVOIR
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste des étudiants d'un département
|
|
|
|
|
|
|
|
|
|
dept: l'acronym d'un département
|
|
|
|
|
formsemestre_id: l'id d'un formesemestre
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Si le formsemestre_id a été renseigné
|
|
|
|
|
if formsemestre_id is not None:
|
2022-01-07 08:49:16 +01:00
|
|
|
|
# Récupération du/des depts
|
|
|
|
|
list_depts = models.Departement.query.filter(
|
|
|
|
|
models.Departement.acronym == dept,
|
2022-02-25 16:03:05 +01:00
|
|
|
|
models.FormSemestre.semestre_id == formsemestre_id,
|
2022-01-07 08:49:16 +01:00
|
|
|
|
)
|
|
|
|
|
list_etuds = []
|
|
|
|
|
for dept in list_depts:
|
|
|
|
|
# Récupération des étudiants d'un département
|
|
|
|
|
x = models.Identite.query.filter(models.Identite.dept_id == dept.getId())
|
|
|
|
|
for y in x:
|
|
|
|
|
# Ajout des étudiants dans la liste global
|
|
|
|
|
list_etuds.append(y)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
else: # Si le formsemestre_id n'a pas été renseigné
|
2022-01-07 08:49:16 +01:00
|
|
|
|
list_depts = models.Departement.query.filter(
|
|
|
|
|
models.Departement.acronym == dept,
|
|
|
|
|
models.FormSemestre.semestre_id == models.Departement.formsemestres,
|
|
|
|
|
)
|
|
|
|
|
list_etuds = []
|
|
|
|
|
for dept in list_depts:
|
|
|
|
|
x = models.Identite.query.filter(models.Identite.dept_id == dept.getId())
|
|
|
|
|
for y in x:
|
|
|
|
|
list_etuds.append(y)
|
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Mise en forme des données
|
2022-01-07 08:49:16 +01:00
|
|
|
|
data = [d.to_dict() for d in list_etuds]
|
|
|
|
|
# return jsonify(data)
|
|
|
|
|
return error_response(501, message="Not implemented")
|
|
|
|
|
|
|
|
|
|
|
2022-02-18 15:53:54 +01:00
|
|
|
|
@bp.route("/departements/<string:dept>/semestres_courant", methods=["GET"])
|
2022-03-01 16:00:41 +01:00
|
|
|
|
# @token_auth.login_required
|
2022-02-18 11:26:17 +01:00
|
|
|
|
def liste_semestres_courant(dept: str):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
|
|
|
|
Liste des semestres actifs d'un départements donné
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
dept: l'acronym d'un département
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération des départements comportant l'acronym mit en paramètre
|
2022-02-18 11:26:17 +01:00
|
|
|
|
depts = models.Departement.query.filter_by(acronym=dept).all()
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de l'id
|
2022-02-18 11:26:17 +01:00
|
|
|
|
id_dept = depts[0].id
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération des semestres suivant id_dept
|
2022-02-18 11:26:17 +01:00
|
|
|
|
semestres = models.FormSemestre.query.filter_by(dept_id=id_dept, etat=True).all()
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Mise en forme des données
|
2022-03-01 16:00:41 +01:00
|
|
|
|
|
|
|
|
|
data = [d.to_dict() for d in semestres]
|
2022-02-18 11:26:17 +01:00
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
|
|
|
|
|
2022-02-18 15:53:54 +01:00
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
@bp.route(
|
|
|
|
|
"/departements/<string:dept>/formations/<int:formation_id>/referentiel_competences",
|
|
|
|
|
methods=["GET"],
|
|
|
|
|
)
|
|
|
|
|
def referenciel_competences(dept: str, formation_id: int):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne le référentiel de compétences
|
|
|
|
|
|
|
|
|
|
dept : l'acronym d'un département
|
|
|
|
|
formation_id : l'id d'une formation
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-18 11:26:17 +01:00
|
|
|
|
# depts = models.Departement.query.filter_by(acronym=dept).all()
|
|
|
|
|
#
|
|
|
|
|
# id_dept = depts[0].id
|
|
|
|
|
#
|
|
|
|
|
# formations = models.Formation.query.filter_by(id=formation_id, dept_id=id_dept).all()
|
|
|
|
|
#
|
|
|
|
|
# ref_comp = formations[0].referentiel_competence_id
|
|
|
|
|
#
|
|
|
|
|
# if ref_comp is None:
|
|
|
|
|
# return error_response(204, message="Pas de référenciel de compétences pour cette formation")
|
|
|
|
|
# else:
|
|
|
|
|
# return jsonify(ref_comp)
|
|
|
|
|
|
|
|
|
|
ref = ApcReferentielCompetences.query.get_or_404(formation_id)
|
|
|
|
|
|
2022-01-08 14:35:02 +01:00
|
|
|
|
return jsonify(ref.to_dict())
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
2022-02-24 16:15:41 +01:00
|
|
|
|
@bp.route("/departements/<string:dept>/formsemestre<string:formsemestre_id>/programme", methods=["GET"])
|
|
|
|
|
def semestre_index(dept: str, formsemestre_id: int):
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-24 16:15:41 +01:00
|
|
|
|
Retourne la liste des Ues, ressources et SAE d'un semestre
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-24 16:15:41 +01:00
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
return error_response(501, message="not implemented")
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
|
|
|
|
|
#################################################### Etudiants ########################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/etudiants", methods=["GET"])
|
|
|
|
|
def etudiants():
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste de tous les étudiants
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de tous les étudiants
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.all()
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Mise en forme des données
|
2022-02-18 11:26:17 +01:00
|
|
|
|
data = [d.to_dict_bul(include_urls=False) for d in etu]
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
return jsonify(data)
|
|
|
|
|
# return error_response(501, message="Not implemented")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/etudiants/courant", methods=["GET"])
|
|
|
|
|
def etudiants_courant():
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste des étudiants courant
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de tous les étudiants
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etus = models.Identite.query.all()
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
data = []
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupère uniquement les étudiants courant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
for etu in etus:
|
|
|
|
|
if etu.inscription_courante() is not None:
|
|
|
|
|
data.append(etu.to_dict_bul(include_urls=False))
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
return jsonify(data)
|
|
|
|
|
# return error_response(501, message="Not implemented")
|
|
|
|
|
|
2022-02-18 15:53:54 +01:00
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
@bp.route("/etudiant/etudid/<int:etudid>", methods=["GET"])
|
|
|
|
|
@bp.route("/etudiant/nip/<int:nip>", methods=["GET"])
|
|
|
|
|
@bp.route("/etudiant/ine/<int:ine>", methods=["GET"])
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def etudiant(etudid: int = None, nip: int = None, ine: int = None):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne les informations de l'étudiant correspondant à l'id passé en paramètres.
|
|
|
|
|
|
|
|
|
|
etudid : l'etudid d'un étudiant
|
|
|
|
|
nip : le code nip d'un étudiant
|
|
|
|
|
ine : le code ine d'un étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"""
|
|
|
|
|
etu = []
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if etudid is not None: # Si route etudid
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(id=etudid).first()
|
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if nip is not None: # Si route nip
|
|
|
|
|
# Récupération de l'étudiant
|
|
|
|
|
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
|
|
|
|
|
|
|
|
|
if ine is not None: # Si route ine
|
|
|
|
|
# Récupération de l'étudiant
|
|
|
|
|
etu = models.Identite.query.filter_by(code_ine=ine).first()
|
|
|
|
|
|
|
|
|
|
# Mise en forme des données
|
2022-02-18 11:26:17 +01:00
|
|
|
|
data = etu.to_dict_bul(include_urls=False)
|
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
|
|
|
|
|
2022-02-18 15:53:54 +01:00
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
@bp.route("/etudiant/etudid/<int:etudid>/formsemestres")
|
|
|
|
|
@bp.route("/etudiant/nip/<int:nip>/formsemestres")
|
|
|
|
|
@bp.route("/etudiant/ine/<int:ine>/formsemestres")
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def etudiant_formsemestres(etudid: int = None, nip: int = None, ine: int = None):
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne les semestres qu'un étudiant a suivis
|
|
|
|
|
|
|
|
|
|
etudid : l'etudid d'un étudiant
|
|
|
|
|
nip : le code nip d'un étudiant
|
|
|
|
|
ine : le code ine d'un étudiant
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-18 11:26:17 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de toutes les inscriptions
|
2022-02-18 11:26:17 +01:00
|
|
|
|
inscriptions = models.FormSemestreInscription.query.all()
|
|
|
|
|
|
|
|
|
|
sems = []
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Filtre les inscriptions contenant l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
for sem in inscriptions:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if etudid is not None: # Si route etudid
|
2022-02-18 11:26:17 +01:00
|
|
|
|
if sem.etudid == etudid:
|
|
|
|
|
sems.append(sem)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if nip is not None: # Si route nip
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
|
|
|
|
if sem.etudid == etu.etudid:
|
|
|
|
|
sems.append(sem)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if ine is not None: # Si route ine
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_ine=ine).firt()
|
|
|
|
|
if sem.etudid == etu.etudid:
|
|
|
|
|
sems.append(sem)
|
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Mise en forme des données
|
2022-02-18 11:26:17 +01:00
|
|
|
|
data_inscriptions = [d.to_dict() for d in sems]
|
|
|
|
|
|
|
|
|
|
formsemestres = []
|
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Filtre les formsemestre contenant les inscriptions de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
for sem in data_inscriptions:
|
|
|
|
|
res = models.FormSemestre.query.filter_by(id=sem['formsemestre_id']).first()
|
|
|
|
|
formsemestres.append(res)
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
data = []
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Mise en forme des données
|
2022-02-18 11:26:17 +01:00
|
|
|
|
for formsem in formsemestres:
|
|
|
|
|
data.append(formsem.to_dict())
|
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/etudiant/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/bulletin", methods=["GET"])
|
|
|
|
|
@bp.route("/etudiant/nip/<int:nip>/formsemestre/<int:formsemestre_id>/bulletin", methods=["GET"])
|
|
|
|
|
@bp.route("/etudiant/ine/<int:ine>/formsemestre/<int:formsemestre_id>/bulletin", methods=["GET"])
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def etudiant_bulletin_semestre(formsemestre_id, etudid: int = None, nip: int = None, ine: int = None):
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +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-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_bulletins_json.make_json_formsemestre_bulletinetud()
|
|
|
|
|
|
|
|
|
|
etu = None
|
|
|
|
|
if etudid is not None: # Si route etudid
|
2022-02-18 11:26:17 +01:00
|
|
|
|
return make_json_formsemestre_bulletinetud(formsemestre_id, etudid)
|
2022-01-07 08:49:16 +01:00
|
|
|
|
else:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if nip is not None: # Si route nip
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if ine is not None: # Si route ine
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_nip=ine).first()
|
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if etu is not None: # Si route nip ou ine
|
|
|
|
|
return make_json_formsemestre_bulletinetud(formsemestre_id, etu.etudid)
|
2022-02-18 11:26:17 +01:00
|
|
|
|
|
|
|
|
|
# return error_response(501, message="Not implemented")
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route(
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"/etudiant/etudid/<int:etudid>/semestre/<int:formsemestre_id>/groups", methods=["GET"]
|
2022-01-07 08:49:16 +01:00
|
|
|
|
)
|
2022-02-18 11:26:17 +01:00
|
|
|
|
@bp.route(
|
|
|
|
|
"/etudiant/nip/<int:nip>/semestre/<int:formsemestre_id>/groups", methods=["GET"]
|
|
|
|
|
)
|
|
|
|
|
@bp.route(
|
|
|
|
|
"/etudiant/ine/<int:ine>/semestre/<int:formsemestre_id>/groups", methods=["GET"]
|
|
|
|
|
)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def etudiant_groups(formsemestre_id: int, etudid: int = None, nip: int = None, ine: int = None):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste des groupes auxquels appartient l'étudiant dans le semestre indiqué
|
|
|
|
|
|
|
|
|
|
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-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_groups.get_etud_groups()
|
2022-02-18 11:26:17 +01:00
|
|
|
|
|
|
|
|
|
if etudid is None:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if nip is not None: # Si route nip
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de sont etudid
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etudid = etu.etudid
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if ine is not None: # Si route ine
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_ine=ine).first()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de sont etudid
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etudid = etu.etudid
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
# Récupération du formsemestre
|
2022-02-18 11:26:17 +01:00
|
|
|
|
sem = models.FormSemestre.query.filter_by(id=formsemestre_id).first()
|
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction get_etud_groups
|
2022-02-18 11:26:17 +01:00
|
|
|
|
data = get_etud_groups(etudid, sem.to_dict())
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
return jsonify(data)
|
|
|
|
|
|
2022-02-18 15:53:54 +01:00
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
##############################################" Formations ############################################################
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
@bp.route("/formations", methods=["GET"])
|
|
|
|
|
def formations():
|
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste des formations
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de toutes les formations
|
2022-02-18 11:26:17 +01:00
|
|
|
|
list_formations = models.Formation.query.all()
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Mise en forme des données
|
2022-02-18 11:26:17 +01:00
|
|
|
|
data = [d.to_dict() for d in list_formations]
|
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formations/<int:formation_id>", methods=["GET"])
|
2022-02-18 11:26:17 +01:00
|
|
|
|
def formations_by_id(formation_id: int):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne une formation en fonction d'un id donné
|
|
|
|
|
|
|
|
|
|
formation_id : l'id d'une formation
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de la formation
|
|
|
|
|
forma = models.Formation.query.filter_by(id=formation_id).first()
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Mise en forme des données
|
2022-02-18 11:26:17 +01:00
|
|
|
|
data = [d.to_dict() for d in forma]
|
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formations/formation_export/<int:formation_id>", methods=["GET"])
|
2022-02-18 11:26:17 +01:00
|
|
|
|
def formation_export_by_formation_id(formation_id: int, export_ids=False):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la formation, avec UE, matières, modules
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilité : app.scodoc.sco_formations.formation_export()
|
|
|
|
|
|
2022-02-22 15:50:52 +01:00
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction formation_export
|
2022-02-22 15:50:52 +01:00
|
|
|
|
data = formation_export(formation_id)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-18 11:26:17 +01:00
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
|
|
|
|
|
|
|
|
|
|
2022-02-22 15:50:52 +01:00
|
|
|
|
@bp.route("/formations/apo/<string:etape_apo>", methods=["GET"])
|
2022-02-18 11:26:17 +01:00
|
|
|
|
def formsemestre_apo(etape_apo: int):
|
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne les informations sur les formsemestres
|
|
|
|
|
|
|
|
|
|
etape_apo : l'id d'une étape apogée
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération des formsemestres
|
2022-02-22 15:50:52 +01:00
|
|
|
|
apos = models.FormSemestreEtape.query.filter_by(etape_apo=etape_apo).all()
|
|
|
|
|
|
|
|
|
|
data = []
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Filtre les formsemestres correspondant + mise en forme des données
|
2022-02-22 15:50:52 +01:00
|
|
|
|
for apo in apos:
|
|
|
|
|
formsem = models.FormSemestre.query.filter_by(id=apo["formsemestre_id"]).first()
|
|
|
|
|
data.append(formsem.to_dict())
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
2022-02-22 15:50:52 +01:00
|
|
|
|
return jsonify(data)
|
|
|
|
|
# return error_response(501, message="Not implemented")
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
@bp.route("/formations/moduleimpl/<int:moduleimpl_id>", methods=["GET"])
|
|
|
|
|
def moduleimpls(moduleimpl_id: int):
|
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste des moduleimpl
|
|
|
|
|
|
|
|
|
|
moduleimpl_id : l'id d'un moduleimpl
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération des tous les moduleimpl
|
|
|
|
|
list_moduleimpls = models.ModuleImpl.query.filter_by(id=moduleimpl_id).all()
|
2022-02-18 11:26:17 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Mise en forme des données
|
2022-02-18 11:26:17 +01:00
|
|
|
|
data = list_moduleimpls[0].to_dict()
|
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route(
|
2022-02-25 16:03:05 +01:00
|
|
|
|
"/formations/moduleimpl/<int:moduleimpl_id>/formsemestre/<int:formsemestre_id>", methods=["GET"])
|
2022-02-18 11:26:17 +01:00
|
|
|
|
def moduleimpls_sem(moduleimpl_id: int, formsemestre_id: int):
|
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste des moduleimpl d'un semestre
|
|
|
|
|
|
|
|
|
|
moduleimpl_id : l'id d'un moduleimpl
|
|
|
|
|
formsemestre_id : l'id d'un formsemestre
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_moduleimpl.moduleimpl_list()
|
|
|
|
|
|
2022-02-22 15:50:52 +01:00
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction moduleimpl_list
|
2022-02-22 15:50:52 +01:00
|
|
|
|
data = moduleimpl_list(moduleimpl_id, formsemestre_id)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
return jsonify(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#################################################### UE ###############################################################
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route(
|
|
|
|
|
"/departements/<string:dept>/formations/programme/<string:sem_id>", methods=["GET"]
|
|
|
|
|
)
|
|
|
|
|
def eus(dept: str, sem_id: int):
|
|
|
|
|
"""
|
|
|
|
|
Liste des UES, ressources et SAE d'un semestre
|
|
|
|
|
"""
|
|
|
|
|
return error_response(501, message="Not implemented")
|
|
|
|
|
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
########################################## Formsemestres ##############################################################
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formations/formsemestre/<int:formsemestre_id>", methods=["GET"])
|
2022-02-18 11:26:17 +01:00
|
|
|
|
def formsemestre(formsemestre_id: int):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne l'information sur le formsemestre correspondant au formsemestre_id
|
|
|
|
|
|
|
|
|
|
formsemestre_id : l'id d'un formsemestre
|
|
|
|
|
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de tous les formsemestres
|
2022-02-18 11:26:17 +01:00
|
|
|
|
list_formsemetre = models.FormSemestre.query.filter_by(id=formsemestre_id)
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Mise en forme des données
|
2022-02-18 11:26:17 +01:00
|
|
|
|
data = list_formsemetre[0].to_dict()
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
return jsonify(data)
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route(
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"/formsemestre/<int:formsemestre_id>/departements/<string:dept>/etudiant/etudid/<int:etudid>/bulletin",
|
2022-01-07 08:49:16 +01:00
|
|
|
|
methods=["GET"],
|
|
|
|
|
)
|
2022-02-18 11:26:17 +01:00
|
|
|
|
@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"],
|
|
|
|
|
)
|
|
|
|
|
def etudiant_bulletin(formsemestre_id, dept, etudid, format="json", *args, size):
|
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne le bulletin de note d'un étudiant
|
|
|
|
|
|
|
|
|
|
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-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_bulletins.formsemestre_billetinetud_dict()
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
data = []
|
|
|
|
|
if args[0] == "short":
|
|
|
|
|
data = formsemestre_bulletinetud_dict(formsemestre_id, etudid, version=args[0])
|
|
|
|
|
elif args[0] == "selectevals":
|
|
|
|
|
data = formsemestre_bulletinetud_dict(formsemestre_id, etudid, version=args[0])
|
|
|
|
|
elif args[0] == "long":
|
|
|
|
|
data = formsemestre_bulletinetud_dict(formsemestre_id, etudid)
|
|
|
|
|
else:
|
2022-02-22 15:50:52 +01:00
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-18 11:26:17 +01:00
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formsemestre/<int:formsemestre_id>/bulletins", methods=["GET"])
|
|
|
|
|
def bulletins(formsemestre_id: int):
|
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne les bulletins d'un formsemestre donné
|
|
|
|
|
|
|
|
|
|
formsemestre_id : l'id d'un formesemestre
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_recapcomplet.formsemestre_recapcomplet()
|
2022-02-21 16:12:31 +01:00
|
|
|
|
|
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction formsemestre_recapcomplet
|
2022-02-21 16:12:31 +01:00
|
|
|
|
data = formsemestre_recapcomplet(formsemestre_id)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
2022-02-18 11:26:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/formsemestre/<int:formsemestre_id>/jury", methods=["GET"])
|
|
|
|
|
def jury(formsemestre_id: int):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne le récapitulatif des décisions jury
|
|
|
|
|
|
|
|
|
|
formsemestre_id : l'id d'un formsemestre
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_pvjury.formsemestre_pvjury()
|
2022-02-21 16:12:31 +01:00
|
|
|
|
|
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction formsemestre_pvjury
|
2022-02-21 16:12:31 +01:00
|
|
|
|
data = formsemestre_pvjury(formsemestre_id)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
############################################### Partitions ############################################################
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/partitions/<int:formsemestre_id>", methods=["GET"])
|
|
|
|
|
def partition(formsemestre_id: int):
|
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste de toutes les partitions d'un formsemestre
|
|
|
|
|
|
|
|
|
|
formsemestre_id : l'id d'un formsemestre
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de toutes les partitions
|
|
|
|
|
partitions = models.Partition.query.filter_by(id=formsemestre_id).all()
|
|
|
|
|
|
|
|
|
|
# Mise en forme des données
|
2022-01-07 08:49:16 +01:00
|
|
|
|
data = [d.to_dict() for d in partitions]
|
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
return jsonify(data)
|
|
|
|
|
# return error_response(501, message="Not implemented")
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
2022-02-21 16:12:31 +01:00
|
|
|
|
# @bp.route(
|
|
|
|
|
# "/partitions/formsemestre/<int:formsemestre_id>/groups/group_ids?with_codes=&all_groups=&etat=",
|
|
|
|
|
# methods=["GET"],
|
|
|
|
|
# )
|
|
|
|
|
@bp.route("/partitions/groups/<int:group_id>", methods=["GET"])
|
|
|
|
|
@bp.route("/partitions/groups/<int:group_id>/etat/<string:etat>", methods=["GET"])
|
|
|
|
|
def etud_in_group(group_id: int, etat=None):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste des étudiants dans un groupe
|
|
|
|
|
|
|
|
|
|
group_id : l'id d'un groupe
|
|
|
|
|
etat :
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_groups.get_group_members()
|
2022-02-21 16:12:31 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if etat is None: # Si l'état n'est pas renseigné
|
2022-02-21 16:12:31 +01:00
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction get_group_members
|
2022-02-21 16:12:31 +01:00
|
|
|
|
data = get_group_members(group_id)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-25 16:03:05 +01:00
|
|
|
|
else: # Si l'état est renseigné
|
2022-02-21 16:12:31 +01:00
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction get_group_members
|
2022-02-21 16:12:31 +01:00
|
|
|
|
data = get_group_members(group_id, etat)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route(
|
2022-02-25 16:03:05 +01:00
|
|
|
|
"/partitions/set_groups?partition_id=<int:partition_id>&groups_lists=<int:groups_lists>&"
|
|
|
|
|
"groups_to_create=<int:groups_to_create>&groups_to_delete=<int:groups_to_delete>", methods=["POST"],
|
2022-01-07 08:49:16 +01:00
|
|
|
|
)
|
|
|
|
|
@token_auth.login_required
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def set_groups(partition_id: int, groups_lists: int, groups_to_delete: int, groups_to_create: int):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
|
|
|
|
Set les groups
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
partition_id : l'id d'une partition
|
|
|
|
|
groups_lists :
|
|
|
|
|
groups_ti_delete : les groupes à supprimer
|
|
|
|
|
groups_to_create : les groupes à créer
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_groups.setGroups()
|
2022-02-18 11:26:17 +01:00
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction setGroups
|
2022-02-18 11:26:17 +01:00
|
|
|
|
setGroups(partition_id, groups_lists, groups_to_create, groups_to_delete)
|
|
|
|
|
return error_response(200, message="Groups set")
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
2022-02-18 15:53:54 +01:00
|
|
|
|
############################################### Evaluations ###########################################################
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/evaluations/<int:moduleimpl_id>", methods=["GET"])
|
|
|
|
|
def evaluations(moduleimpl_id: int):
|
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste des évaluations à partir de l'id d'un moduleimpl
|
|
|
|
|
|
|
|
|
|
moduleimpl_id : l'id d'un moduleimpl
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de toutes les évaluations
|
|
|
|
|
evals = models.Evaluation.query.filter_by(id=moduleimpl_id).all()
|
|
|
|
|
|
|
|
|
|
# Mise en forme des données
|
2022-01-07 08:49:16 +01:00
|
|
|
|
data = [d.to_dict() for d in evals]
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
return jsonify(data)
|
|
|
|
|
# return error_response(501, message="Not implemented")
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/evaluations/eval_notes/<int:evaluation_id>", methods=["GET"])
|
|
|
|
|
def evaluation_notes(evaluation_id: int):
|
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste des notes à partir de l'id d'une évaluation donnée
|
|
|
|
|
|
|
|
|
|
evaluation_id : l'id d'une évaluation
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_evaluation_db.do_evaluation_get_all_notes()
|
|
|
|
|
|
2022-02-21 16:12:31 +01:00
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction do_evaluation_get_all_notes
|
2022-02-21 16:12:31 +01:00
|
|
|
|
data = do_evaluation_get_all_notes(evaluation_id)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-18 11:26:17 +01:00
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
2022-02-24 16:15:41 +01:00
|
|
|
|
@bp.route("/evaluations/eval_set_notes?eval_id=<int:eval_id>&etudid=<int:etudid>¬e=<float:note>", methods=["POST"])
|
|
|
|
|
@bp.route("/evaluations/eval_set_notes?eval_id=<int:eval_id>&nip=<int:nip>¬e=<float:note>", methods=["POST"])
|
|
|
|
|
@bp.route("/evaluations/eval_set_notes?eval_id=<int:eval_id>&ine=<int:ine>¬e=<float:note>", methods=["POST"])
|
2022-01-07 08:49:16 +01:00
|
|
|
|
@token_auth.login_required
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def evaluation_set_notes(eval_id: int, note: float, etudid: int = None, nip: int = None, ine: int = None):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
|
|
|
|
Set les notes d'une évaluation pour un étudiant donnée
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
eval_id : l'id d'une évaluation
|
|
|
|
|
note : la note à attribuer
|
|
|
|
|
etudid : l'etudid d'un étudiant
|
|
|
|
|
nip : le code nip d'un étudiant
|
|
|
|
|
ine : le code ine d'un étudiant
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_saisie_notes.notes_add()
|
2022-02-24 16:15:41 +01:00
|
|
|
|
|
|
|
|
|
# Qu'est ce qu'un user ???
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# notes_add()
|
2022-01-07 08:49:16 +01:00
|
|
|
|
return error_response(501, message="Not implemented")
|
|
|
|
|
|
|
|
|
|
|
2022-02-18 16:08:50 +01:00
|
|
|
|
|
2022-02-18 15:53:54 +01:00
|
|
|
|
#################################################### Jury #############################################################
|
2022-02-18 16:08:50 +01:00
|
|
|
|
|
|
|
|
|
|
2022-02-18 15:53:54 +01:00
|
|
|
|
@bp.route("/jury/formsemestre/<int:formsemestre_id>/preparation_jury", methods=["GET"])
|
2022-02-18 16:08:50 +01:00
|
|
|
|
def jury_preparation(formsemestre_id: int): # XXX TODO check à quoi resemble le retour de la fonction
|
2022-02-18 15:53:54 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la feuille de préparation du jury
|
|
|
|
|
|
|
|
|
|
formsemestre_id : l'id d'un formsemestre
|
2022-02-18 15:53:54 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_prepajury.feuille_preparation_jury()
|
2022-02-18 16:08:50 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction feuille_preparation_jury
|
2022-02-18 16:08:50 +01:00
|
|
|
|
prepa_jury = feuille_preparation_jury(formsemestre_id)
|
|
|
|
|
|
2022-02-18 15:53:54 +01:00
|
|
|
|
return error_response(501, message="Not implemented")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/jury/formsemestre/<int:formsemestre_id>/decisions_jury", methods=["GET"])
|
2022-02-18 16:08:50 +01:00
|
|
|
|
def jury_decisions(formsemestre_id: int): # XXX TODO check à quoi resemble le retour de la fonction
|
2022-02-18 15:53:54 +01:00
|
|
|
|
"""
|
|
|
|
|
Retourne les décisions du jury suivant un formsemestre donné
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
formsemestre_id : l'id d'un formsemestre
|
2022-02-18 15:53:54 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_pvjury.formsemestre_pvjury()
|
2022-02-18 16:08:50 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction formsemestre_pvjury
|
2022-02-18 16:08:50 +01:00
|
|
|
|
decision_jury = formsemestre_pvjury(formsemestre_id)
|
|
|
|
|
|
2022-02-18 15:53:54 +01:00
|
|
|
|
return error_response(501, message="Not implemented")
|
|
|
|
|
|
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
@bp.route("/jury/set_decision/etudid?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
|
|
|
|
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>", methods=["POST"])
|
|
|
|
|
@bp.route("/jury/set_decision/nip?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
|
|
|
|
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>", methods=["POST"])
|
|
|
|
|
@bp.route("/jury/set_decision/ine?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
|
|
|
|
|
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>", methods=["POST"])
|
|
|
|
|
def set_decision_jury(formsemestre_id: int, decision_jury: str, devenir_jury: str, assiduite: bool,
|
|
|
|
|
etudid: int = None, nip: int = None, ine: int = None):
|
2022-02-18 15:53:54 +01:00
|
|
|
|
"""
|
|
|
|
|
Attribuer la décision du jury et le devenir à un etudiant
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
formsemestre_id : l'id d'un formsemestre
|
|
|
|
|
decision_jury : la décision du jury
|
|
|
|
|
devenir_jury : le devenir du jury
|
|
|
|
|
assiduite : True ou False
|
|
|
|
|
etudid : l'etudid d'un étudiant
|
|
|
|
|
nip: le code nip d'un étudiant
|
|
|
|
|
ine : le code ine d'un étudiant
|
2022-02-18 15:53:54 +01:00
|
|
|
|
"""
|
|
|
|
|
return error_response(501, message="Not implemented")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/jury/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/annule_decision", methods=["DELETE"])
|
|
|
|
|
@bp.route("/jury/nip/<int:nip>/formsemestre/<int:formsemestre_id>/annule_decision", methods=["DELETE"])
|
|
|
|
|
@bp.route("/jury/ine/<int:ine>/formsemestre/<int:formsemestre_id>/annule_decision", methods=["DELETE"])
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def annule_decision_jury(formsemestre_id: int, etudid: int = None, nip: int = None, ine: int = None):
|
2022-02-18 15:53:54 +01:00
|
|
|
|
"""
|
|
|
|
|
Supprime la déciosion du jury pour un étudiant donné
|
2022-02-25 16:03:05 +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
|
2022-02-18 15:53:54 +01:00
|
|
|
|
"""
|
|
|
|
|
return error_response(501, message="Not implemented")
|
|
|
|
|
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
#################################################### Absences #########################################################
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
2022-02-22 15:50:52 +01:00
|
|
|
|
@bp.route("/absences/etudid/<int:etudid>", methods=["GET"])
|
|
|
|
|
@bp.route("/absences/nip/<int:nip>", methods=["GET"])
|
|
|
|
|
@bp.route("/absences/ine/<int:ine>", methods=["GET"])
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def absences(etudid: int = None, nip: int = None, ine: int = None):
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste des absences d'un étudiant donné
|
|
|
|
|
|
|
|
|
|
etudid : l'etudid d'un étudiant
|
|
|
|
|
nip: le code nip d'un étudiant
|
|
|
|
|
ine : le code ine d'un étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
abs = None
|
|
|
|
|
if etudid is not None: # Si route etudid
|
|
|
|
|
# Récupération des absences de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
abs = models.Absence.query.filter_by(etudid=etudid).all()
|
|
|
|
|
else:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if nip is not None: # Si route nip
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération des absences de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
abs = models.Absence.query.filter_by(etudid=etu.etudid).all()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if ine is not None: # Si route ine
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_ine=ine).first()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération des absences de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
abs = models.Absence.query.filter_by(etudid=etu.etudid).all()
|
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if abs is not None: # Si des absences ont bien été trouvé
|
|
|
|
|
# Mise en forme des données
|
2022-02-18 11:26:17 +01:00
|
|
|
|
data = [d.to_dict() for d in abs]
|
|
|
|
|
|
|
|
|
|
return jsonify(data)
|
|
|
|
|
return error_response(501, message="Not implemented")
|
|
|
|
|
|
|
|
|
|
|
2022-02-22 15:50:52 +01:00
|
|
|
|
@bp.route("/absences/etudid/<int:etudid>/abs_just_only", methods=["GET"])
|
|
|
|
|
@bp.route("/absences/nip/<int:nip>/abs_just_only", methods=["GET"])
|
|
|
|
|
@bp.route("/absences/ine/<int:ine>/abs_just_only", methods=["GET"])
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def absences_justify(etudid: int = None, nip: int = None, ine: int = None):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retourne la liste des absences justifiées d'un étudiant donné
|
|
|
|
|
|
|
|
|
|
etudid : l'etudid d'un étudiant
|
|
|
|
|
nip: le code nip d'un étudiant
|
|
|
|
|
ine : le code ine d'un étudiant
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
abs = None
|
|
|
|
|
if etudid is not None: # Si route etudid
|
|
|
|
|
# Récupération des absences justifiées de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
abs = models.Absence.query.filter_by(etudid=etudid, estjust=True).all()
|
|
|
|
|
else:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if nip is not None: # Si route nip
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération des absences justifiées de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
abs = models.Absence.query.filter_by(etudid=etu.etudid, estjust=True).all()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if ine is not None: # Si route ine
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_ine=ine).first()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération des absences justifiées de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
abs = models.Absence.query.filter_by(etudid=etu.etudid, estjust=True).all()
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if abs is not None: # Si des absences ont bien été trouvé
|
|
|
|
|
# Mise en forme des données
|
2022-02-18 11:26:17 +01:00
|
|
|
|
data = [d.to_dict() for d in abs]
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
return jsonify(data)
|
2022-01-07 08:49:16 +01:00
|
|
|
|
return error_response(501, message="Not implemented")
|
|
|
|
|
|
|
|
|
|
|
2022-02-23 16:10:10 +01:00
|
|
|
|
@bp.route("/absences/abs_signale?etudid=<int:etudid>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
2022-02-22 15:50:52 +01:00
|
|
|
|
"&description=<string:description>", methods=["POST"])
|
2022-02-23 16:10:10 +01:00
|
|
|
|
@bp.route("/absences/abs_signale?nip=<int:nip>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
2022-02-22 15:50:52 +01:00
|
|
|
|
"&description=<string:description>", methods=["POST"])
|
|
|
|
|
@bp.route("/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
|
|
|
|
"&description=<string:description>", methods=["POST"])
|
|
|
|
|
@bp.route("/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
|
|
|
|
"&description=<string:description>&moduleimpl_id=<int:moduleimpl_id>", methods=["POST"])
|
2022-01-07 08:49:16 +01:00
|
|
|
|
@token_auth.login_required
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def abs_signale(date: datetime, matin: bool, justif: bool, etudid: int = None, nip: int = None, ine: int = None,
|
|
|
|
|
description: str = None, moduleimpl_id: int = None):
|
2022-02-22 15:50:52 +01:00
|
|
|
|
"""
|
|
|
|
|
Permet d'ajouter une absence en base
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
date : la date de l'absence
|
|
|
|
|
matin : True ou False
|
|
|
|
|
justif : True ou False
|
|
|
|
|
etudid : l'etudid d'un étudiant
|
|
|
|
|
nip: le code nip d'un étudiant
|
|
|
|
|
ine : le code ine d'un étudiant
|
|
|
|
|
description : description possible à ajouter sur l'absence
|
|
|
|
|
moduleimpl_id : l'id d'un moduleimpl
|
2022-02-22 15:50:52 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonctions utilisées : app.scodoc.sco_abs.add_absence() et app.scodoc.sco_abs.add_justif()
|
|
|
|
|
|
|
|
|
|
if description is not None: # Si la description a été renseignée
|
|
|
|
|
if moduleimpl_id is not None: # Si le moduleimpl a été renseigné
|
|
|
|
|
if etudid is not None: # Si route etudid
|
2022-02-22 15:50:52 +01:00
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_absence
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_absence(etudid, date, matin, justif, description, moduleimpl_id)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_justif
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_justif(etudid, date, matin, description)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if nip is not None: # Si route nip
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-22 15:50:52 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_absence
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_absence(etu.etudid, date, matin, justif, description, moduleimpl_id)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_justif
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_justif(etu.etudid, date, matin, description)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if ine is not None: # Si route ine
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-22 15:50:52 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_ine=ine).first()
|
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_absence
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_absence(etu.etudid, date, matin, justif, description, moduleimpl_id)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_justif
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_justif(etu.etudid, date, matin, description)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
2022-02-22 15:50:52 +01:00
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
else: # Si le moduleimpl n'a pas été renseigné
|
|
|
|
|
if etudid is not None: # Si route etudid
|
2022-02-22 15:50:52 +01:00
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_absence
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_absence(etudid, date, matin, justif, description)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_justif
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_justif(etudid, date, matin, description)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if nip is not None: # Si route nip
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-22 15:50:52 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_absence
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_absence(etu.etudid, date, matin, justif, description)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_justif
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_justif(etu.etudid, date, matin, description)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if ine is not None: # Si route ine
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-22 15:50:52 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_ine=ine).first()
|
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_absence
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_absence(etu.etudid, date, matin, justif, description)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_justif
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_justif(etu.etudid, date, matin, description)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
else:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if etudid is not None: # Si route etudid
|
2022-02-22 15:50:52 +01:00
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_absence
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_absence(etudid, date, matin, justif)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_justif
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_justif(etudid, date, matin)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if nip is not None: # Si route nip
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-22 15:50:52 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_absence
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_absence(etu.etudid, date, matin, justif)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_justif
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_justif(etu.etudid, date, matin)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if ine is not None: # Si route ine
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-22 15:50:52 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_ine=ine).first()
|
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_absence
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_absence(etu.etudid, date, matin, justif)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction add_justif
|
2022-02-22 15:50:52 +01:00
|
|
|
|
add_justif(etu.etudid, date, matin)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
|
|
|
|
|
return error_response(200, message="OK")
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
@bp.route("/absences/abs_annule?etudid=<int:etudid>&jour=<string:jour>&matin=<string:matin>", methods=["POST"])
|
|
|
|
|
@bp.route("/absences/abs_annule?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>", methods=["POST"])
|
|
|
|
|
@bp.route("/absences/abs_annule?ine=<int:ine>&jour=<string:jour>&matin=<string:matin>", methods=["POST"])
|
2022-01-07 08:49:16 +01:00
|
|
|
|
@token_auth.login_required
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def abs_annule(jour: datetime, matin: str, etudid: int = None, nip: int = None, ine: int = None):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
|
|
|
|
Retourne un html
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
jour : la date de l'absence a annulé
|
|
|
|
|
matin : True ou False
|
|
|
|
|
etudid : l'etudid d'un étudiant
|
|
|
|
|
nip: le code nip d'un étudiant
|
|
|
|
|
ine : le code ine d'un étudiant
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_abs.annule_absence()
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
if etudid is None:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if nip is not None: # Si route nip
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de l'etudid de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etudid = etu.etudid
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if ine is not None: # Si route ine
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_ine=ine).first()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de l'etudid de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etudid = etu.etudid
|
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction annule_absence
|
2022-02-18 11:26:17 +01:00
|
|
|
|
annule_absence(etudid, jour, matin)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
|
|
|
|
|
return error_response(200, message="OK")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/absences/abs_annule_justif?etudid=<int:etudid>&jour=<string:jour>&matin=<string:matin>", methods=["POST"])
|
|
|
|
|
@bp.route("/absences/abs_annule_justif?nip=<int:nip>&jour=<string:jour>&matin=<string:matin>", methods=["POST"])
|
|
|
|
|
@bp.route("/absences/abs_annule_justif?ine=<int:ine>&jour=<string:jour>&matin=<string:matin>", methods=["POST"])
|
2022-01-07 08:49:16 +01:00
|
|
|
|
@token_auth.login_required
|
2022-02-25 16:03:05 +01:00
|
|
|
|
def abs_annule_justif(jour: datetime, matin: str, etudid: int = None, nip: int = None, ine: int = None):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
|
|
|
|
Retourne un html
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
jour : la date de l'absence a annulé
|
|
|
|
|
matin : True ou False
|
|
|
|
|
etudid : l'etudid d'un étudiant
|
|
|
|
|
nip: le code nip d'un étudiant
|
|
|
|
|
ine : le code ine d'un étudiant
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_abs.annule_justif()
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
if etudid is None:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
if nip is not None: # Si route nip
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_nip=nip).first()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de l'etudid de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etudid = etu.etudid
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
if ine is not None: # Si route ine
|
|
|
|
|
# Récupération de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etu = models.Identite.query.filter_by(code_ine=ine).first()
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Récupération de l'etudid de l'étudiant
|
2022-02-18 11:26:17 +01:00
|
|
|
|
etudid = etu.etudid
|
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction annule_justif
|
2022-02-18 11:26:17 +01:00
|
|
|
|
annule_justif(etudid, jour, matin)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
|
|
|
|
|
return error_response(200, message="OK")
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
@bp.route("/absences/abs_group_etat/?group_id=<int:group_id>&date_debut=date_debut&date_fin=date_fin", methods=["GET"])
|
|
|
|
|
def abs_groupe_etat(group_id: int, date_debut, date_fin, with_boursier=True, format="html"):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
Retoune la liste des absences d'un ou plusieurs groupes entre deux dates
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Fonction utilisée : app.scodoc.sco_groups.get_group_members() et app.scodoc.sco_abs.list_abs_date()
|
|
|
|
|
|
2022-02-23 16:10:10 +01:00
|
|
|
|
try:
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Utilisation de la fonction get_group_members
|
2022-02-23 16:10:10 +01:00
|
|
|
|
members = get_group_members(group_id)
|
|
|
|
|
except ValueError:
|
|
|
|
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
2022-02-23 16:10:10 +01:00
|
|
|
|
data = []
|
2022-02-25 16:03:05 +01:00
|
|
|
|
# Filtre entre les deux dates renseignées
|
2022-02-23 16:10:10 +01:00
|
|
|
|
for member in members:
|
|
|
|
|
abs = list_abs_date(member.id, date_debut, date_fin)
|
|
|
|
|
data.append(abs)
|
2022-02-18 11:26:17 +01:00
|
|
|
|
|
2022-02-23 16:10:10 +01:00
|
|
|
|
# return jsonify(data) # XXX TODO faire en sorte de pouvoir renvoyer sa (ex to_dict() dans absences)
|
2022-01-07 08:49:16 +01:00
|
|
|
|
return error_response(501, message="Not implemented")
|
|
|
|
|
|
|
|
|
|
|
2022-02-18 11:26:17 +01:00
|
|
|
|
###################################################### Logos ##########################################################
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-24 16:15:41 +01:00
|
|
|
|
# XXX TODO voir get_logo déjà existant dans app/views/scodoc.py
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
@bp.route("/logos", methods=["GET"])
|
|
|
|
|
def liste_logos(format="json"):
|
|
|
|
|
"""
|
|
|
|
|
Liste des logos définis pour le site scodoc.
|
|
|
|
|
"""
|
2022-02-22 15:50:52 +01:00
|
|
|
|
# fonction to use : list_logos()
|
2022-02-24 16:15:41 +01:00
|
|
|
|
# try:
|
|
|
|
|
# res = list_logos()
|
|
|
|
|
# except ValueError:
|
|
|
|
|
# return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
#
|
|
|
|
|
# if res is None:
|
|
|
|
|
# return error_response(200, message="Aucun logo trouvé correspondant aux informations renseignés")
|
|
|
|
|
#
|
|
|
|
|
# return res
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
2022-02-23 16:10:10 +01:00
|
|
|
|
|
|
|
|
|
@bp.route("/logos/<string:logo_name>", methods=["GET"])
|
|
|
|
|
def recup_logo_global(logo_name: str):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
|
|
|
|
Retourne l'image au format png ou jpg
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
logo_name : le nom du logo rechercher
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-22 15:50:52 +01:00
|
|
|
|
# fonction to use find_logo
|
2022-02-24 16:15:41 +01:00
|
|
|
|
# try:
|
|
|
|
|
# res = find_logo(logo_name)
|
|
|
|
|
# except ValueError:
|
|
|
|
|
# return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
#
|
|
|
|
|
# if res is None:
|
|
|
|
|
# return error_response(200, message="Aucun logo trouvé correspondant aux informations renseignés")
|
|
|
|
|
#
|
|
|
|
|
# return res
|
2022-02-23 16:10:10 +01:00
|
|
|
|
|
|
|
|
|
|
2022-01-07 08:49:16 +01:00
|
|
|
|
@bp.route("/departements/<string:dept>/logos", methods=["GET"])
|
|
|
|
|
def logo_dept(dept: str):
|
|
|
|
|
"""
|
|
|
|
|
Liste des logos définis pour le département visé.
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
dept : l'id d'un département
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-23 16:10:10 +01:00
|
|
|
|
# fonction to use: _list_dept_logos
|
2022-02-24 16:15:41 +01:00
|
|
|
|
# dept_id = models.Departement.query.filter_by(acronym=dept).first()
|
|
|
|
|
# try:
|
|
|
|
|
# res = _list_dept_logos(dept_id.id)
|
|
|
|
|
# except ValueError:
|
|
|
|
|
# return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
#
|
|
|
|
|
# if res is None:
|
|
|
|
|
# return error_response(200, message="Aucun logo trouvé correspondant aux informations renseignés")
|
|
|
|
|
#
|
|
|
|
|
# return res
|
2022-01-07 08:49:16 +01:00
|
|
|
|
|
2022-02-23 16:10:10 +01:00
|
|
|
|
|
|
|
|
|
@bp.route("/departement/<string:dept>/logos/<string:logo_name>", methods=["GET"])
|
|
|
|
|
def recup_logo_dept_global(dept: str, logo_name: str):
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
|
|
|
|
L'image format png ou jpg
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
dept : l'id d'un département
|
|
|
|
|
logo_name : le nom du logo rechercher
|
2022-01-07 08:49:16 +01:00
|
|
|
|
"""
|
2022-02-22 15:50:52 +01:00
|
|
|
|
# fonction to use find_logo
|
2022-02-24 16:15:41 +01:00
|
|
|
|
# dept_id = models.Departement.query.filter_by(acronym=dept).first()
|
|
|
|
|
# try:
|
|
|
|
|
# res = find_logo(logo_name, dept_id.id)
|
|
|
|
|
# except ValueError:
|
|
|
|
|
# return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
#
|
|
|
|
|
# if res is None:
|
|
|
|
|
# return error_response(200, message="Aucun logo trouvé correspondant aux informations renseignés")
|
|
|
|
|
#
|
|
|
|
|
# return res
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
################################################## Tests ##############################################################
|
|
|
|
|
|
|
|
|
|
import requests
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
SCODOC_USER = ""
|
|
|
|
|
SCODOC_PASSWORD = ""
|
|
|
|
|
SCODOC_URL = ""
|
|
|
|
|
CHECK_CERTIFICATE = bool(int(os.environ.get("CHECK_CERTIFICATE", False)))
|
|
|
|
|
|
2022-03-01 16:00:41 +01:00
|
|
|
|
# r0 = requests.post(
|
|
|
|
|
# SCODOC_URL + "/ScoDoc/api/tokens", auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
# )
|
|
|
|
|
# token = r0.json()["token"]
|
|
|
|
|
# HEADERS = {"Authorization": f"Bearer {token}"}
|
|
|
|
|
|
|
|
|
|
DEPT = None
|
|
|
|
|
FORMSEMESTRE = None
|
|
|
|
|
ETU = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/test_dept", methods=["GET"])
|
|
|
|
|
def get_departement():
|
|
|
|
|
"""
|
|
|
|
|
Retourne un département pour les tests
|
|
|
|
|
"""
|
|
|
|
|
r = requests.get(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api/departements",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
2022-02-25 16:03:05 +01:00
|
|
|
|
)
|
2022-03-01 16:00:41 +01:00
|
|
|
|
|
|
|
|
|
if r.status_code == 200:
|
|
|
|
|
dept_id = r.json()[0]
|
|
|
|
|
# print(dept_id)
|
|
|
|
|
|
|
|
|
|
dept = models.Departement.query.filter_by(id=dept_id).first()
|
|
|
|
|
dept = dept.to_dict()
|
|
|
|
|
|
|
|
|
|
if "id" in dept:
|
|
|
|
|
if "acronym" in dept:
|
|
|
|
|
if "description" in dept:
|
|
|
|
|
if "visible" in dept:
|
|
|
|
|
if "date_creation" in dept:
|
|
|
|
|
global DEPT
|
|
|
|
|
DEPT = dept
|
|
|
|
|
|
|
|
|
|
return error_response(200, "OK")
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "date_creation field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "visible field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "description field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "acronym field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "id field missing")
|
|
|
|
|
|
|
|
|
|
return error_response(409, "La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/test_formsemestre", methods=["GET"])
|
|
|
|
|
def get_formsemestre():
|
|
|
|
|
"""
|
|
|
|
|
Retourne un formsemestre pour les tests
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
global DEPT
|
|
|
|
|
dept_acronym = DEPT["acronym"]
|
|
|
|
|
|
|
|
|
|
r = requests.get(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api/departements/" + dept_acronym + "/semestres_courant",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if r.status_code == 200:
|
|
|
|
|
formsemestre = r.json()[0]
|
|
|
|
|
# print(r.json()[0])
|
|
|
|
|
|
|
|
|
|
if "titre" in formsemestre:
|
|
|
|
|
if "gestion_semestrielle" in formsemestre:
|
|
|
|
|
if "scodoc7_id" in formsemestre:
|
|
|
|
|
if "date_debut" in formsemestre:
|
|
|
|
|
if "bul_bgcolor" in formsemestre:
|
|
|
|
|
if "date_fin" in formsemestre:
|
|
|
|
|
if "resp_can_edit" in formsemestre:
|
|
|
|
|
if "semestre_id" in formsemestre:
|
|
|
|
|
if "bul_hide_xml" in formsemestre:
|
|
|
|
|
if "elt_annee_apo" in formsemestre:
|
|
|
|
|
if "block_moyennes" in formsemestre:
|
|
|
|
|
if "formsemestre_id" in formsemestre:
|
|
|
|
|
if "titre_num" in formsemestre:
|
|
|
|
|
if "date_debut_iso" in formsemestre:
|
|
|
|
|
if "date_fin_iso" in formsemestre:
|
|
|
|
|
if "responsables" in formsemestre:
|
|
|
|
|
global FORMSEMESTRE
|
|
|
|
|
FORMSEMESTRE = formsemestre
|
|
|
|
|
|
|
|
|
|
# print(FORMSEMESTRE)
|
|
|
|
|
|
|
|
|
|
return error_response(200, "OK")
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"responsables field "
|
|
|
|
|
"missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"date_fin_iso field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"date_debut_iso field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"titre_num field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"formsemestre_id field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"block_moyennes field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"elt_annee_apo field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"bul_hide_xml field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"semestre_id field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"resp_can_edit field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"date_fin field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"bul_bgcolor field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"date_debut field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"scodoc7_id field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"gestion_semestrielle field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501,
|
|
|
|
|
"titre field missing")
|
|
|
|
|
|
|
|
|
|
return error_response(409, "La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/test_etu", methods=["GET"])
|
|
|
|
|
def get_etudiant():
|
|
|
|
|
"""
|
|
|
|
|
Retourne un étudiant pour les tests
|
|
|
|
|
"""
|
|
|
|
|
# print(DEPT.get_data().decode("utf-8"))
|
|
|
|
|
# dept = DEPT
|
|
|
|
|
r = requests.get(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api/etudiants",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if r.status_code == 200:
|
|
|
|
|
etu = r.json()[0]
|
|
|
|
|
|
|
|
|
|
if "civilite" in etu:
|
|
|
|
|
if "code_ine" in etu:
|
|
|
|
|
if "code_nip" in etu:
|
|
|
|
|
if "date_naissance" in etu:
|
|
|
|
|
if "email" in etu:
|
|
|
|
|
if "emailperso" in etu:
|
|
|
|
|
if "etudid" in etu:
|
|
|
|
|
if "nom" in etu:
|
|
|
|
|
if "prenom" in etu:
|
|
|
|
|
global ETU
|
|
|
|
|
ETU = etu
|
|
|
|
|
# print(ETU)
|
|
|
|
|
|
|
|
|
|
return error_response(200, "OK")
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "prenom field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "nom field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "etudid field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "emailperso field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "email field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "date_naissance field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "code_nip field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "code_ine field missing")
|
|
|
|
|
else:
|
|
|
|
|
return error_response(501, "civilite field missing")
|
|
|
|
|
|
|
|
|
|
return error_response(409, "La requête ne peut être traitée en l’état actuel")
|
|
|
|
|
|
|
|
|
|
|
2022-02-25 16:03:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_routes_departements():
|
|
|
|
|
"""
|
|
|
|
|
Test les routes de la partie Département
|
|
|
|
|
"""
|
|
|
|
|
# departements
|
2022-03-01 16:00:41 +01:00
|
|
|
|
r1 = requests.get(
|
2022-02-25 16:03:05 +01:00
|
|
|
|
SCODOC_URL + "/ScoDoc/api/departements",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# liste_etudiants
|
|
|
|
|
r2 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api/departements/<string:dept>/etudiants/liste/<int:sem_id>",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# liste_semestres_courant
|
|
|
|
|
r3 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# referenciel_competences
|
|
|
|
|
r4 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# semestre_index
|
|
|
|
|
r5 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_routes_etudiants():
|
|
|
|
|
"""
|
|
|
|
|
Test les routes de la partie Etudiants
|
|
|
|
|
"""
|
2022-03-01 16:00:41 +01:00
|
|
|
|
# etudiants
|
|
|
|
|
r1 = requests.get(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api/etudiants",
|
2022-02-25 16:03:05 +01:00
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
2022-03-01 16:00:41 +01:00
|
|
|
|
# etudiants_courant
|
2022-02-25 16:03:05 +01:00
|
|
|
|
r2 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
2022-03-01 16:00:41 +01:00
|
|
|
|
# etudiant
|
2022-02-25 16:03:05 +01:00
|
|
|
|
r3 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
2022-03-01 16:00:41 +01:00
|
|
|
|
# etudiant_formsemestres
|
2022-02-25 16:03:05 +01:00
|
|
|
|
r4 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
2022-03-01 16:00:41 +01:00
|
|
|
|
# etudiant_bulletin_semestre
|
2022-02-25 16:03:05 +01:00
|
|
|
|
r5 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
2022-03-01 16:00:41 +01:00
|
|
|
|
# etudiant_groups
|
2022-02-25 16:03:05 +01:00
|
|
|
|
r6 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_routes_formation():
|
|
|
|
|
"""
|
|
|
|
|
Test les routes de la partie Formation
|
|
|
|
|
"""
|
|
|
|
|
# formations
|
|
|
|
|
r1 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# formations_by_id
|
|
|
|
|
r2 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# formation_export_by_formation_id
|
|
|
|
|
r3 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# formsemestre_apo
|
|
|
|
|
r4 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# moduleimpls
|
|
|
|
|
r5 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# moduleimpls_sem
|
|
|
|
|
r6 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_routes_formsemestres():
|
|
|
|
|
"""
|
|
|
|
|
Test les routes de la partie Formsemestres
|
|
|
|
|
"""
|
|
|
|
|
# formsemestre
|
|
|
|
|
r1 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# etudiant_bulletin
|
|
|
|
|
r2 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# bulletins
|
|
|
|
|
r3 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# jury
|
|
|
|
|
r4 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_routes_partitions():
|
|
|
|
|
"""
|
|
|
|
|
Test les routes de la partie Partitions
|
|
|
|
|
"""
|
|
|
|
|
# partition
|
|
|
|
|
r1 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# etud_in_group
|
|
|
|
|
r2 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# set_groups
|
|
|
|
|
r3 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_routes_evaluations():
|
|
|
|
|
"""
|
|
|
|
|
Test les routes de la partie Evaluations
|
|
|
|
|
"""
|
|
|
|
|
# evaluations
|
|
|
|
|
r1 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# evaluation_notes
|
|
|
|
|
r2 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# evaluation_set_notes
|
|
|
|
|
r3 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_routes_jury():
|
|
|
|
|
"""
|
|
|
|
|
Test les routes de la partie Jury
|
|
|
|
|
"""
|
|
|
|
|
# jury_preparation
|
|
|
|
|
r1 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# jury_decisions
|
|
|
|
|
r2 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# set_decision_jury
|
|
|
|
|
r3 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# annule_decision_jury
|
|
|
|
|
r4 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_routes_absences():
|
|
|
|
|
"""
|
|
|
|
|
Test les routes de la partie Absences
|
|
|
|
|
"""
|
|
|
|
|
# absences
|
|
|
|
|
r1 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# absences_justify
|
|
|
|
|
r2 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# abs_signale
|
|
|
|
|
r3 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# abs_annule
|
|
|
|
|
r4 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# abs_annule_justif
|
|
|
|
|
r5 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# abs_groupe_etat
|
|
|
|
|
r6 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_routes_logos():
|
|
|
|
|
"""
|
|
|
|
|
Test les routes de la partie Logos
|
|
|
|
|
"""
|
|
|
|
|
# liste_logos
|
|
|
|
|
r1 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# recup_logo_global
|
|
|
|
|
r2 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# logo_dept
|
|
|
|
|
r3 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# recup_logo_dept_global
|
|
|
|
|
r4 = requests.post(
|
|
|
|
|
SCODOC_URL + "/ScoDoc/api",
|
|
|
|
|
auth=(SCODOC_USER, SCODOC_PASSWORD)
|
|
|
|
|
)
|