From 5f868fd27c24d07bca7cccdf164551ffe7909cbf Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 26 Nov 2021 18:13:37 +0100 Subject: [PATCH] filtre UE sport --- app/comp/moy_mod.py | 2 +- app/models/formations.py | 1 + app/models/formsemestre.py | 5 ++++- app/scodoc/sco_evaluation_edit.py | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/comp/moy_mod.py b/app/comp/moy_mod.py index 7f8aed34..ffe12358 100644 --- a/app/comp/moy_mod.py +++ b/app/comp/moy_mod.py @@ -52,7 +52,7 @@ def df_load_evaluations_poids( """ modimpl = ModuleImpl.query.get(moduleimpl_id) evaluations = Evaluation.query.filter_by(moduleimpl_id=moduleimpl_id).all() - ues = modimpl.formsemestre.query_ues().all() + ues = modimpl.formsemestre.query_ues(with_sport=False).all() ue_ids = [ue.id for ue in ues] evaluation_ids = [evaluation.id for evaluation in evaluations] df = pd.DataFrame(columns=ue_ids, index=evaluation_ids, dtype=float) diff --git a/app/models/formations.py b/app/models/formations.py index 72ffc69c..3c00bb73 100644 --- a/app/models/formations.py +++ b/app/models/formations.py @@ -92,6 +92,7 @@ class UniteEns(db.Model): e = dict(self.__dict__) e.pop("_sa_instance_state", None) # ScoDoc7 output_formators + e["ue_id"] = self.id e["numero"] = e["numero"] if e["numero"] else 0 e["ects"] = e["ects"] if e["ects"] else 0.0 e["coefficient"] = e["coefficient"] if e["coefficient"] else 0.0 diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index 61b5ff65..8c3a475b 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -17,6 +17,7 @@ from app.scodoc import sco_evaluation_db from app.models.formations import UniteEns, Module from app.models.moduleimpls import ModuleImpl from app.models.etudiants import Identite +from app.scodoc import sco_codes_parcours class FormSemestre(db.Model): @@ -92,7 +93,7 @@ class FormSemestre(db.Model): if self.modalite is None: self.modalite = FormationModalite.DEFAULT_MODALITE - def query_ues(self) -> flask_sqlalchemy.BaseQuery: + def query_ues(self, with_sport=False) -> flask_sqlalchemy.BaseQuery: """UE des modules de ce semestre. - Formations classiques: les UEs auxquelles appartiennent les modules mis en place dans ce semestre. @@ -109,6 +110,8 @@ class FormSemestre(db.Model): Module.id == ModuleImpl.module_id, UniteEns.id == Module.ue_id, ) + if not with_sport: + sem_ues = sem_ues.filter(UniteEns.type != sco_codes_parcours.UE_SPORT) return sem_ues diff --git a/app/scodoc/sco_evaluation_edit.py b/app/scodoc/sco_evaluation_edit.py index e6619fe2..1f5cca23 100644 --- a/app/scodoc/sco_evaluation_edit.py +++ b/app/scodoc/sco_evaluation_edit.py @@ -66,7 +66,7 @@ def evaluation_create_form( mod = modimpl["module"] formsemestre_id = modimpl["formsemestre_id"] sem = FormSemestre.query.get(formsemestre_id) - sem_ues = sem.query_ues().all() + sem_ues = sem.query_ues(with_sport=False).all() is_malus = mod["module_type"] == ModuleType.MALUS is_apc = mod["module_type"] in (ModuleType.RESSOURCE, ModuleType.SAE)