forked from ScoDoc/ScoDoc
Fix: calcul du malus BUT par UE. Close #417
This commit is contained in:
parent
c0c78074b2
commit
33b5621af7
@ -496,18 +496,25 @@ def compute_malus(
|
|||||||
"""
|
"""
|
||||||
ues_idx = [ue.id for ue in ues]
|
ues_idx = [ue.id for ue in ues]
|
||||||
malus = pd.DataFrame(index=modimpl_inscr_df.index, columns=ues_idx, dtype=float)
|
malus = pd.DataFrame(index=modimpl_inscr_df.index, columns=ues_idx, dtype=float)
|
||||||
|
|
||||||
|
if len(sem_modimpl_moys.shape) > 2:
|
||||||
|
# BUT: ne retient que la 1er composante du malus qui est scalaire
|
||||||
|
# au sens ou chaque note de malus n'affecte que la moyenne de l'UE
|
||||||
|
# de rattachement de son module.
|
||||||
|
sem_modimpl_moys_scalar = sem_modimpl_moys[:, :, 0]
|
||||||
|
else: # classic
|
||||||
|
sem_modimpl_moys_scalar = sem_modimpl_moys
|
||||||
for ue in ues:
|
for ue in ues:
|
||||||
if ue.type != UE_SPORT:
|
if ue.type != UE_SPORT:
|
||||||
modimpl_mask = np.array(
|
modimpl_mask = np.array(
|
||||||
[
|
[
|
||||||
(m.module.module_type == ModuleType.MALUS)
|
(m.module.module_type == ModuleType.MALUS)
|
||||||
and (m.module.ue.id == ue.id)
|
and (m.module.ue.id == ue.id) # UE de rattachement
|
||||||
for m in formsemestre.modimpls_sorted
|
for m in formsemestre.modimpls_sorted
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
if len(modimpl_mask):
|
if len(modimpl_mask):
|
||||||
# somme 1er composante du malus qui est scalaire
|
malus_moys = sem_modimpl_moys_scalar[:, modimpl_mask].sum(axis=1)
|
||||||
malus_moys = sem_modimpl_moys[:, modimpl_mask, 0].sum(axis=1)
|
|
||||||
malus[ue.id] = malus_moys
|
malus[ue.id] = malus_moys
|
||||||
|
|
||||||
malus.fillna(0.0, inplace=True)
|
malus.fillna(0.0, inplace=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user