forked from ScoDoc/ScoDoc
Bul. BUT: n'affiche que les UE dans lesquelles on est inscrit à au moins un module
This commit is contained in:
parent
41469707af
commit
920aeb066f
@ -32,7 +32,7 @@ class BulletinBUT(ResultatsSemestreBUT):
|
||||
ue_idx = self.modimpl_coefs_df.index.get_loc(ue.id)
|
||||
etud_moy_module = self.sem_cube[etud_idx] # module x UE
|
||||
for modimpl in modimpls:
|
||||
if self.modimpl_inscr_df[str(modimpl.id)][etud.id]: # si inscrit
|
||||
if self.modimpl_inscr_df[modimpl.id][etud.id]: # si inscrit
|
||||
if ue.type != UE_SPORT:
|
||||
coef = self.modimpl_coefs_df[modimpl.id][ue.id]
|
||||
if coef > 0:
|
||||
@ -115,7 +115,7 @@ class BulletinBUT(ResultatsSemestreBUT):
|
||||
# except RuntimeWarning: # all nans in np.nanmean
|
||||
# pass
|
||||
modimpl_results = self.modimpls_results[modimpl.id]
|
||||
if self.modimpl_inscr_df[str(modimpl.id)][etud.id]: # si inscrit
|
||||
if self.modimpl_inscr_df[modimpl.id][etud.id]: # si inscrit
|
||||
d[modimpl.module.code] = {
|
||||
"id": modimpl.id,
|
||||
"titre": modimpl.module.titre,
|
||||
@ -183,7 +183,9 @@ class BulletinBUT(ResultatsSemestreBUT):
|
||||
details = [
|
||||
f"{fmt_note(bonus_vect[ue.id])} sur {ue.acronyme}"
|
||||
for ue in self.ues
|
||||
if ue.id in self.bonus_ues and bonus_vect[ue.id] > 0.0
|
||||
if self.modimpls_in_ue(ue.id, etudid)
|
||||
and ue.id in self.bonus_ues
|
||||
and bonus_vect[ue.id] > 0.0
|
||||
]
|
||||
if details:
|
||||
return "Bonus de " + ", ".join(details)
|
||||
@ -256,7 +258,11 @@ class BulletinBUT(ResultatsSemestreBUT):
|
||||
"ressources": self.etud_mods_results(etud, self.ressources),
|
||||
"saes": self.etud_mods_results(etud, self.saes),
|
||||
"ues": {
|
||||
ue.acronyme: self.etud_ue_results(etud, ue) for ue in self.ues
|
||||
ue.acronyme: self.etud_ue_results(etud, ue)
|
||||
for ue in self.ues
|
||||
if self.modimpls_in_ue(
|
||||
ue.id, etud.id
|
||||
) # si l'UE comporte des modules auxquels on est inscrit
|
||||
},
|
||||
"semestre": semestre_infos,
|
||||
},
|
||||
|
@ -35,6 +35,8 @@ def df_load_modimpl_inscr(formsemestre) -> pd.DataFrame:
|
||||
dtype=int,
|
||||
)
|
||||
df = df.merge(ins_df, how="left", left_index=True, right_index=True)
|
||||
# Force columns names to integers (moduleimpl ids)
|
||||
df.columns = pd.Int64Index([int(x) for x in df.columns], dtype="int")
|
||||
# les colonnes de df sont en float (Nan) quand il n'y a
|
||||
# aucun inscrit au module.
|
||||
df.fillna(0, inplace=True) # les non-inscrits
|
||||
|
@ -130,6 +130,16 @@ class ResultatsSemestre:
|
||||
"""
|
||||
return self.formsemestre.query_ues().filter(UniteEns.type != UE_SPORT).all()
|
||||
|
||||
def modimpls_in_ue(self, ue_id, etudid):
|
||||
"""Liste des modimpl de cet ue auxquels l'étudiant est inscrit"""
|
||||
# sert pour l'affichage ou non de l'UE sur le bulletin
|
||||
return [
|
||||
modimpl
|
||||
for modimpl in self.formsemestre.modimpls_sorted
|
||||
if modimpl.module.ue.id == ue_id
|
||||
and self.modimpl_inscr_df[modimpl.id][etudid]
|
||||
]
|
||||
|
||||
@cached_property
|
||||
def ue_au_dessus(self, seuil=10.0) -> pd.DataFrame:
|
||||
"""DataFrame columns UE, rows etudid, valeurs: bool
|
||||
|
Loading…
Reference in New Issue
Block a user