Bulletin BUT: n'affiche que les modules auxquels l'étudiant est inscrit

This commit is contained in:
Emmanuel Viennet 2022-01-09 21:48:58 +01:00
parent 68dec8e1f8
commit 0a1264051c
4 changed files with 47 additions and 36 deletions

View File

@ -107,15 +107,16 @@ class ResultatsSemestreBUT:
ue_idx = self.modimpl_coefs_df.index.get_loc(ue.id) ue_idx = self.modimpl_coefs_df.index.get_loc(ue.id)
etud_moy_module = self.sem_cube[etud_idx] # module x UE etud_moy_module = self.sem_cube[etud_idx] # module x UE
for mi in modimpls: for mi in modimpls:
if self.modimpl_inscr_df[str(mi.id)][etud.id]: # si inscrit
coef = self.modimpl_coefs_df[mi.id][ue.id] coef = self.modimpl_coefs_df[mi.id][ue.id]
if coef > 0: if coef > 0:
d[mi.module.code] = { d[mi.module.code] = {
"id": mi.id, "id": mi.id,
"coef": coef, "coef": coef,
"moyenne": fmt_note( "moyenne": fmt_note(
etud_moy_module[self.modimpl_coefs_df.columns.get_loc(mi.id)][ etud_moy_module[
ue_idx self.modimpl_coefs_df.columns.get_loc(mi.id)
] ][ue_idx]
), ),
} }
return d return d
@ -163,6 +164,7 @@ class ResultatsSemestreBUT:
# moy_indicative_mod = np.nanmean(self.sem_cube[etud_idx, mod_idx]) # moy_indicative_mod = np.nanmean(self.sem_cube[etud_idx, mod_idx])
# except RuntimeWarning: # all nans in np.nanmean # except RuntimeWarning: # all nans in np.nanmean
# pass # pass
if self.modimpl_inscr_df[str(mi.id)][etud.id]: # si inscrit
d[mi.module.code] = { d[mi.module.code] = {
"id": mi.id, "id": mi.id,
"titre": mi.module.titre, "titre": mi.module.titre,

View File

@ -44,6 +44,9 @@ class ModuleImpl(db.Model):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(ModuleImpl, self).__init__(**kwargs) super(ModuleImpl, self).__init__(**kwargs)
def __repr__(self):
return f"<{self.__class__.__name__} {self.id} module={repr(self.module)}>"
def get_evaluations_poids(self) -> pd.DataFrame: def get_evaluations_poids(self) -> pd.DataFrame:
"""Les poids des évaluations vers les UE (accès via cache)""" """Les poids des évaluations vers les UE (accès via cache)"""
evaluations_poids = df_cache.EvaluationsPoidsCache.get(self.id) evaluations_poids = df_cache.EvaluationsPoidsCache.get(self.id)

View File

@ -470,7 +470,13 @@ def ue_delete(ue_id=None, delete_validations=False, dialog_confirmed=False):
if ue.modules.all(): if ue.modules.all():
raise ScoValueError( raise ScoValueError(
f"""Suppression de l'UE {ue.titre} impossible car f"""Suppression de l'UE {ue.titre} impossible car
des modules (ou SAÉ ou ressources) lui sont rattachés.""" des modules (ou SAÉ ou ressources) lui sont rattachés.""",
dest_url=url_for(
"notes.ue_table",
scodoc_dept=g.scodoc_dept,
formation_id=ue.formation.id,
semestre_idx=ue.semestre_idx,
),
) )
if not can_delete_ue(ue): if not can_delete_ue(ue):
raise ScoNonEmptyFormationObject( raise ScoNonEmptyFormationObject(

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.1.20" SCOVERSION = "9.1.21"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"