forked from ScoDoc/ScoDoc
Fix #376: Bulletin BUT: le bonus sport affiché aux non inscrits
This commit is contained in:
parent
9ffb07ccce
commit
c0d02d7e3b
@ -76,9 +76,20 @@ class BulletinBUT:
|
||||
) -> dict:
|
||||
"""dict synthèse résultats UE
|
||||
etud_groups : liste des groupes, pour affichage du rang.
|
||||
Si UE sport et étudiant non inscrit, renvoie dict vide.
|
||||
"""
|
||||
res = self.res
|
||||
|
||||
if ue.type == UE_SPORT:
|
||||
modimpls_spo = [
|
||||
modimpl
|
||||
for modimpl in res.formsemestre.modimpls_sorted
|
||||
if modimpl.module.ue.type == UE_SPORT
|
||||
]
|
||||
# L'étudiant est-il inscrit à l'un des modules de l'UE bonus ?
|
||||
if not any(res.modimpl_inscr_df.loc[etud.id][[m.id for m in modimpls_spo]]):
|
||||
return {}
|
||||
|
||||
d = {
|
||||
"id": ue.id,
|
||||
"titre": ue.titre,
|
||||
@ -126,16 +137,12 @@ class BulletinBUT:
|
||||
"value": rang,
|
||||
"total": effectif,
|
||||
}
|
||||
else:
|
||||
else: # UE BONUS
|
||||
d["modules"] = self.etud_mods_results(etud, modimpls_spo)
|
||||
# ceci suppose que l'on a une seule UE bonus,
|
||||
# en tous cas elles auront la même description
|
||||
d["bonus_description"] = self.etud_bonus_description(etud.id)
|
||||
modimpls_spo = [
|
||||
modimpl
|
||||
for modimpl in res.formsemestre.modimpls_sorted
|
||||
if modimpl.module.ue.type == UE_SPORT
|
||||
]
|
||||
d["modules"] = self.etud_mods_results(etud, modimpls_spo)
|
||||
|
||||
return d
|
||||
|
||||
def etud_ues_capitalisees(self, etud: Identite) -> dict:
|
||||
@ -411,21 +418,23 @@ class BulletinBUT:
|
||||
etud, res.ressources, version=version
|
||||
),
|
||||
"saes": self.etud_mods_results(etud, res.saes, version=version),
|
||||
"ues": {
|
||||
ue.acronyme: self.etud_ue_results(
|
||||
etud,
|
||||
ue,
|
||||
decision_ue=decisions_ues.get(ue.id, {}),
|
||||
etud_groups=etud_groups,
|
||||
)
|
||||
for ue in res.ues
|
||||
# si l'UE comporte des modules auxquels on est inscrit:
|
||||
if ((ue.type == UE_SPORT) or ue.id in etud_ues_ids)
|
||||
},
|
||||
"ues_capitalisees": self.etud_ues_capitalisees(etud),
|
||||
"semestre": semestre_infos,
|
||||
},
|
||||
)
|
||||
d_ues = {}
|
||||
for ue in res.ues:
|
||||
# si l'UE comporte des modules auxquels on est inscrit:
|
||||
if (ue.type == UE_SPORT) or ue.id in etud_ues_ids:
|
||||
ue_r = self.etud_ue_results(
|
||||
etud,
|
||||
ue,
|
||||
decision_ue=decisions_ues.get(ue.id, {}),
|
||||
etud_groups=etud_groups,
|
||||
)
|
||||
if ue_r: # exclu UE soprt sans inscriptions
|
||||
d_ues[ue.acronyme] = ue_r
|
||||
d["ues"] = d_ues
|
||||
|
||||
else:
|
||||
semestre_infos.update(
|
||||
|
Loading…
Reference in New Issue
Block a user