1
0
forked from ScoDoc/ScoDoc

Améliore tableau indicateurs BUT (bacs S1)

This commit is contained in:
Emmanuel Viennet 2022-09-27 09:24:00 +02:00
parent 810e1f6cff
commit 47682e54d2
3 changed files with 22 additions and 11 deletions

View File

@ -904,7 +904,7 @@ class DecisionsProposeesUE(DecisionsProposees):
etud=etud,
code_valide=self.validation.code if self.validation is not None else None,
)
log(f"built {self}")
# log(f"built {self}")
self.formsemestre = formsemestre
self.ue: UniteEns = ue
self.rcue: RegroupementCoherentUE = None

View File

@ -84,6 +84,10 @@ def formsemestre_but_indicateurs(formsemestre_id: int, format="html"):
row["titre_indicateur"] = titre_indicateur
rows.append(row)
# ensure Total is the rightmost column
del bacs[bacs.index("Total")]
bacs.append("Total")
tab = GenTable(
titles={bac: bac for bac in bacs},
columns_ids=["titre_indicateur"] + bacs,
@ -172,15 +176,17 @@ def but_indicateurs_by_bac(formsemestre: FormSemestre) -> dict[str:dict]:
if len(formsemestre_id_precedents) == 1
else formsemestre_impair.session_id()
)
indicateurs_by_bac["Total"].update(
_indicateurs_enquete_but_inscrits(formsemestre_impair.inscriptions, suffix)
)
for bac, inscriptions in _formsemestre_inscriptions_by_bac(
formsemestre_impair
).items():
if bac not in indicateurs_by_bac:
indicateurs_by_bac[bac] = defaultdict(lambda: 0)
indicateurs_by_bac[bac].update(
_indicateurs_enquete_but_inscrits(inscriptions, suffix)
)
indicateurs_by_bac["Total"].update(
_indicateurs_enquete_but_inscrits(formsemestre_impair.inscriptions, suffix)
)
return indicateurs_by_bac
@ -201,12 +207,17 @@ def _indicateurs_enquete_but_inscrits(
Suffixe les clés avec _suffix"""
if suffix:
suffix = "_" + suffix
return {
"nb_inscr" + suffix: len(inscriptions),
"nb_actifs" + suffix: len([i for i in inscriptions if i.etat == scu.INSCRIT]),
"nb_def" + suffix: len([i for i in inscriptions if i.etat == scu.DEF]),
"nb_dem" + suffix: len([i for i in inscriptions if i.etat == scu.DEMISSION]),
}
return defaultdict(
lambda: "?",
{
"nb_inscr" + suffix: len(inscriptions),
"nb_actifs"
+ suffix: len([i for i in inscriptions if i.etat == scu.INSCRIT]),
"nb_def" + suffix: len([i for i in inscriptions if i.etat == scu.DEF]),
"nb_dem"
+ suffix: len([i for i in inscriptions if i.etat == scu.DEMISSION]),
},
)
def _indicateurs_enquete_but(

View File

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