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
1 changed files with 40 additions and 14 deletions

View File

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