Améliore les entêtes de l'export Excel + sépare données min/moy/max

This commit is contained in:
Cléo Baras 2024-02-01 18:10:21 +01:00
parent 556725b3ef
commit 387af40b65

View File

@ -323,9 +323,9 @@ class JuryPE(object):
for etudid in etudids: for etudid in etudids:
etudiant = self.etudiants.identites[etudid] etudiant = self.etudiants.identites[etudid]
donnees[etudid] = { donnees[etudid] = {
"Nom": etudiant.nom, ("Identité", "", "Civilite"): etudiant.civilite_str,
"Prenom": etudiant.prenom, ("Identité", "", "Nom"): etudiant.nom,
"Civilite": etudiant.civilite_str, ("Identité", "", "Prenom"): etudiant.prenom,
} }
for aggregat in aggregats: for aggregat in aggregats:
@ -334,9 +334,11 @@ class JuryPE(object):
# Les moyennes par tag de cette trajectoire # Les moyennes par tag de cette trajectoire
donnees[etudid] |= { donnees[etudid] |= {
f"{aggregat} notes ": "-", (aggregat, "", "notes"): "-",
f"{aggregat} class. (groupe)": "-", (aggregat, "groupe", "class."): "-",
f"{aggregat} min | moy | max (groupe)": "-", (aggregat, "groupe", "min"): "-",
(aggregat, "groupe", "moy"): "-",
(aggregat, "groupe", "max"): "-",
} }
if trajectoire: if trajectoire:
trajectoire_tagguee = self.trajectoires_tagguees[ trajectoire_tagguee = self.trajectoires_tagguees[
@ -346,23 +348,47 @@ class JuryPE(object):
bilan = trajectoire_tagguee.moyennes_tags[tag] bilan = trajectoire_tagguee.moyennes_tags[tag]
donnees[etudid] |= { donnees[etudid] |= {
f"{aggregat} notes ": round(bilan["notes"].loc[etudid], 2), (aggregat, "", "notes"): round(
f"{aggregat} class. (groupe)": f"{bilan['classements'].loc[etudid]}/{bilan['nb_inscrits']}", bilan["notes"].loc[etudid], 2
f"{aggregat} min | moy | max (groupe)": f"{bilan['min']:.1f} | {bilan['moy']:.1f} | {bilan['max']:.1f}", ),
(
aggregat,
"groupe",
"class",
): f"{bilan['classements'].loc[etudid]}/{bilan['nb_inscrits']}",
(aggregat, "groupe", "min"): round(
bilan["min"], 2
),
(aggregat, "groupe", "moy"): round(
bilan["moy"], 2
),
(aggregat, "groupe", "max"): round(
bilan["max"], 2
)
} }
"""L'interclassement""" """L'interclassement"""
interclass = self.interclassements_taggues[aggregat] interclass = self.interclassements_taggues[aggregat]
donnees[etudid] |= { donnees[etudid] |= {
f"{aggregat} class. (promo)": "-", (aggregat, f"promotion {self.diplome}", "class."): "-",
f"{aggregat} min | moy | max (promo)": "-", (aggregat, f"promotion {self.diplome}", "min"): "-",
(aggregat, f"promotion {self.diplome}", "moy"): "-",
(aggregat, f"promotion {self.diplome}", "max"): "-",
} }
if tag in interclass.moyennes_tags: if tag in interclass.moyennes_tags:
bilan = interclass.moyennes_tags[tag] bilan = interclass.moyennes_tags[tag]
donnees[etudid] |= { donnees[etudid] |= {
f"{aggregat} class. (promo)": f"{bilan['classements'].loc[etudid]}/{bilan['nb_inscrits']}", (aggregat, f"promotion {self.diplome}", "class."): f"{bilan['classements'].loc[etudid]}/{bilan['nb_inscrits']}",
f"{aggregat} min | moy | max (promo)": f"{bilan['min']:.1f} | {bilan['moy']:.1f} | {bilan['max']:.1f}", (aggregat, f"promotion {self.diplome}", "min"): round(
bilan["min"], 2
),
(aggregat, f"promotion {self.diplome}", "moy"): round(
bilan["moy"], 2
),
(aggregat, f"promotion {self.diplome}", "max"): round(
bilan["max"], 2
)
} }
# Fin de l'aggrégat # Fin de l'aggrégat
@ -370,7 +396,7 @@ class JuryPE(object):
df = pd.DataFrame.from_dict(donnees, orient="index") df = pd.DataFrame.from_dict(donnees, orient="index")
# Tri par nom/prénom # Tri par nom/prénom
df.sort_values(by=["Nom", "Prenom"], inplace=True) df.sort_values(by=[("Identité", "", "Nom"), ("Identité", "", "Prenom")], inplace=True)
return df return df