From 2db5e04a59d28d0b9e4b8fb90fffe0bdff2ab2ab Mon Sep 17 00:00:00 2001 From: leonard_montalbano Date: Mon, 30 May 2022 16:08:04 +0200 Subject: [PATCH] =?UTF-8?q?=C3=A9bauche=20etat=5Fevals=20ticket=20#387?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/formsemestres.py | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/app/api/formsemestres.py b/app/api/formsemestres.py index 7dfd2f643..393422b42 100644 --- a/app/api/formsemestres.py +++ b/app/api/formsemestres.py @@ -7,6 +7,8 @@ from app.api import bp from app.api.auth import token_auth, token_permission_required from app.models import Departement, FormSemestre, FormSemestreEtape from app.scodoc.sco_bulletins import get_formsemestre_bulletin_etud_json +from app.scodoc.sco_evaluation_recap import evaluations_recap_table +from app.scodoc.sco_evaluations import do_evaluation_etat_in_sem, do_evaluation_etat from app.scodoc.sco_groups import get_etud_groups from app.scodoc.sco_permissions import Permission from app.scodoc.sco_utils import ModuleType @@ -461,3 +463,60 @@ def formsemestre_etudiants(formsemestre_id: int, etat: str): etu["groups"] = get_etud_groups(etu["id"], formsemestre_id) return jsonify(res) + + +@bp.route("/formsemestre//etat_evals", methods=["GET"]) +@token_auth.login_required +@token_permission_required(Permission.APIView) +def etat_evals(formsemestre_id: int): + """ + Retourne les informations sur l'état des évaluations d'un semestre donnée + + formsemestre_id : l'id d'un semestre + + Exemple de résultat : + + """ + # fonction utilisé : do_evaluation_etat() + + formsemestre = models.FormSemestre.query.filter_by( + id=formsemestre_id + ).first_or_404() + + dept = Departement.query.get(formsemestre.dept_id) + + app.set_sco_dept(dept.acronym) + + list_ues = formsemestre.query_ues() + + moduleimpls = formsemestre.modimpls + + res = [] + ues = {} + modules = [] + + for moduleimpl in moduleimpls: + x = {} + module = models.Module.query.filter_by(id=moduleimpl.id).first_or_404() + x["id"] = module.id + x["titre"] = module.titre + + list_eval = [] + for eval in moduleimpl.evaluations: + list_eval.append(do_evaluation_etat(eval.id)) + x["evaluations"] = list_eval + + print(list_eval) + + modules.append(x) + + for ue in list_ues: + ues[ue.acronyme] = modules + + # print(ues) + print( + "###############################################################################" + ) + # print(modules) + + return jsonify(do_evaluation_etat_in_sem(formsemestre_id))