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,17 +107,18 @@ 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:
coef = self.modimpl_coefs_df[mi.id][ue.id] if self.modimpl_inscr_df[str(mi.id)][etud.id]: # si inscrit
if coef > 0: coef = self.modimpl_coefs_df[mi.id][ue.id]
d[mi.module.code] = { if coef > 0:
"id": mi.id, d[mi.module.code] = {
"coef": coef, "id": mi.id,
"moyenne": fmt_note( "coef": coef,
etud_moy_module[self.modimpl_coefs_df.columns.get_loc(mi.id)][ "moyenne": fmt_note(
ue_idx etud_moy_module[
] self.modimpl_coefs_df.columns.get_loc(mi.id)
), ][ue_idx]
} ),
}
return d return d
def etud_ue_results(self, etud, ue): def etud_ue_results(self, etud, ue):
@ -163,29 +164,30 @@ 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
d[mi.module.code] = { if self.modimpl_inscr_df[str(mi.id)][etud.id]: # si inscrit
"id": mi.id, d[mi.module.code] = {
"titre": mi.module.titre, "id": mi.id,
"code_apogee": mi.module.code_apogee, "titre": mi.module.titre,
"url": url_for( "code_apogee": mi.module.code_apogee,
"notes.moduleimpl_status", "url": url_for(
scodoc_dept=g.scodoc_dept, "notes.moduleimpl_status",
moduleimpl_id=mi.id, scodoc_dept=g.scodoc_dept,
), moduleimpl_id=mi.id,
"moyenne": { ),
# # moyenne indicative de module: moyenne des UE, ignorant celles sans notes (nan) "moyenne": {
# "value": fmt_note(moy_indicative_mod), # # moyenne indicative de module: moyenne des UE, ignorant celles sans notes (nan)
# "min": fmt_note(moyennes_etuds.min()), # "value": fmt_note(moy_indicative_mod),
# "max": fmt_note(moyennes_etuds.max()), # "min": fmt_note(moyennes_etuds.min()),
# "moy": fmt_note(moyennes_etuds.mean()), # "max": fmt_note(moyennes_etuds.max()),
}, # "moy": fmt_note(moyennes_etuds.mean()),
"evaluations": [ },
self.etud_eval_results(etud, e) "evaluations": [
for eidx, e in enumerate(mi.evaluations) self.etud_eval_results(etud, e)
if e.visibulletin for eidx, e in enumerate(mi.evaluations)
and self.modimpls_evaluations_complete[mi.id][eidx] if e.visibulletin
], and self.modimpls_evaluations_complete[mi.id][eidx]
} ],
}
return d return d
def etud_eval_results(self, etud, e) -> dict: def etud_eval_results(self, etud, e) -> dict:

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"