1
0
forked from ScoDoc/ScoDoc

filtre UE sport

This commit is contained in:
Emmanuel Viennet 2021-11-26 18:13:37 +01:00
parent 5a3c25e67f
commit 5f868fd27c
4 changed files with 7 additions and 3 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)