Ajout option pour désactiver l'édition de classeurs intermédiaires
This commit is contained in:
parent
5827a37a31
commit
dbe7f5d482
@ -61,5 +61,10 @@ class ParametrageClasseurPE(FlaskForm):
|
||||
# default=False,
|
||||
# render_kw={"checked": ""},
|
||||
)
|
||||
|
||||
classeurs_detailles = BooleanField(
|
||||
"Générer des classeurs intermédiaires (pour debuggage)", default=False
|
||||
)
|
||||
|
||||
submit = SubmitField("Générer les classeurs poursuites d'études")
|
||||
cancel = SubmitField("Annuler", render_kw={"formnovalidate": True})
|
||||
|
@ -101,6 +101,7 @@ class JuryPE(object):
|
||||
"moyennes_ues_rcues": True,
|
||||
"min_max_moy": False,
|
||||
"publipostage": False,
|
||||
"classeurs_detailles": False,
|
||||
},
|
||||
):
|
||||
pe_affichage.pe_start_log()
|
||||
@ -221,43 +222,43 @@ class JuryPE(object):
|
||||
# Crée le semestre_tag et exécute les calculs de moyennes
|
||||
ressembuttag = pe_ressemtag.ResSemBUTTag(formsemestre, options=self.options)
|
||||
self.ressembuttags[frmsem_id] = ressembuttag
|
||||
# Ajoute les étudiants découverts dans les ressembuttags aux données des étudiants
|
||||
# nbre_etudiants_ajoutes = self.etudiants.add_etudiants(
|
||||
# ressembuttag.etudids_sorted
|
||||
# )
|
||||
# if nbre_etudiants_ajoutes:
|
||||
# pe_affichage.pe_print(
|
||||
# f"--> Ajout de {nbre_etudiants_ajoutes} étudiants aux données du jury"
|
||||
# )
|
||||
|
||||
# Intègre le bilan des semestres taggués au zip final
|
||||
pe_affichage.pe_print(f"2) Bilan", info=True)
|
||||
output = io.BytesIO()
|
||||
with pd.ExcelWriter( # pylint: disable=abstract-class-instantiated
|
||||
output, engine="openpyxl"
|
||||
) as writer:
|
||||
onglets = []
|
||||
for res_sem_tag in self.ressembuttags.values():
|
||||
if res_sem_tag.is_significatif():
|
||||
onglet = res_sem_tag.get_repr(verbose=True)
|
||||
onglet = onglet.replace("Semestre ", "S")
|
||||
onglets += ["📊" + onglet]
|
||||
df = res_sem_tag.to_df(options=self.options)
|
||||
# Conversion colonnes en multiindex
|
||||
df = convert_colonnes_to_multiindex(df)
|
||||
# écriture dans l'onglet
|
||||
df.to_excel(writer, onglet, index=True, header=True)
|
||||
pe_affichage.pe_print(
|
||||
f"--> Export excel de {', '.join(onglets)}", info=True
|
||||
)
|
||||
output.seek(0)
|
||||
if (
|
||||
"classeurs_detailles" in self.options
|
||||
and self.options["classeurs_detailles"]
|
||||
):
|
||||
output = io.BytesIO()
|
||||
with pd.ExcelWriter( # pylint: disable=abstract-class-instantiated
|
||||
output, engine="openpyxl"
|
||||
) as writer:
|
||||
onglets = []
|
||||
for res_sem_tag in self.ressembuttags.values():
|
||||
if res_sem_tag.is_significatif():
|
||||
onglet = res_sem_tag.get_repr(verbose=True)
|
||||
onglet = onglet.replace("Semestre ", "S")
|
||||
onglets += ["📊" + onglet]
|
||||
df = res_sem_tag.to_df(options=self.options)
|
||||
# Conversion colonnes en multiindex
|
||||
df = convert_colonnes_to_multiindex(df)
|
||||
# écriture dans l'onglet
|
||||
df.to_excel(writer, onglet, index=True, header=True)
|
||||
pe_affichage.pe_print(
|
||||
f"--> Export excel de {', '.join(onglets)}", info=True
|
||||
)
|
||||
output.seek(0)
|
||||
|
||||
self.add_file_to_zip(
|
||||
zipfile,
|
||||
f"ResSemBUTTags_{self.diplome}.xlsx",
|
||||
output.read(),
|
||||
path="details",
|
||||
)
|
||||
self.add_file_to_zip(
|
||||
zipfile,
|
||||
f"ResSemBUTTags_{self.diplome}.xlsx",
|
||||
output.read(),
|
||||
path="details",
|
||||
)
|
||||
else:
|
||||
pe_affichage.pe_print(
|
||||
"--> Pas d'export excel (option non cochée)", info=True
|
||||
)
|
||||
|
||||
def _gen_trajectoires(self):
|
||||
"""Génère l'ensemble des trajectoires (RCS), qui traduisent les différents
|
||||
@ -324,33 +325,39 @@ class JuryPE(object):
|
||||
|
||||
# Intègre le bilan des semestres taggués au zip final
|
||||
pe_affichage.pe_print("2) Bilan", info=True)
|
||||
output = io.BytesIO()
|
||||
with pd.ExcelWriter( # pylint: disable=abstract-class-instantiated
|
||||
output, engine="openpyxl"
|
||||
) as writer:
|
||||
onglets = []
|
||||
for sxtag in self.sxtags.values():
|
||||
if sxtag.is_significatif():
|
||||
onglet = sxtag.get_repr(verbose=False)
|
||||
onglets += ["📊" + onglet]
|
||||
df = sxtag.to_df(options=self.options)
|
||||
# Conversion colonnes en multiindex
|
||||
df = convert_colonnes_to_multiindex(df)
|
||||
if (
|
||||
"classeurs_detailles" in self.options
|
||||
and self.options["classeurs_detailles"]
|
||||
):
|
||||
output = io.BytesIO()
|
||||
with pd.ExcelWriter( # pylint: disable=abstract-class-instantiated
|
||||
output, engine="openpyxl"
|
||||
) as writer:
|
||||
onglets = []
|
||||
for sxtag in self.sxtags.values():
|
||||
if sxtag.is_significatif():
|
||||
onglet = sxtag.get_repr(verbose=False)
|
||||
onglets += ["📊" + onglet]
|
||||
df = sxtag.to_df(options=self.options)
|
||||
# Conversion colonnes en multiindex
|
||||
df = convert_colonnes_to_multiindex(df)
|
||||
|
||||
# écriture dans l'onglet
|
||||
df.to_excel(writer, onglet, index=True, header=True)
|
||||
pe_affichage.pe_print(
|
||||
f"--> Export excel de {', '.join(onglets)}", info=True
|
||||
)
|
||||
# écriture dans l'onglet
|
||||
df.to_excel(writer, onglet, index=True, header=True)
|
||||
pe_affichage.pe_print(
|
||||
f"--> Export excel de {', '.join(onglets)}", info=True
|
||||
)
|
||||
|
||||
output.seek(0)
|
||||
if onglets:
|
||||
self.add_file_to_zip(
|
||||
zipfile,
|
||||
f"semestres_taggues_{self.diplome}.xlsx",
|
||||
output.read(),
|
||||
path="details",
|
||||
)
|
||||
output.seek(0)
|
||||
if onglets:
|
||||
self.add_file_to_zip(
|
||||
zipfile,
|
||||
f"semestres_taggues_{self.diplome}.xlsx",
|
||||
output.read(),
|
||||
path="details",
|
||||
)
|
||||
else:
|
||||
pe_affichage.pe_print("--> Pas d'export Excel (option non cochée)")
|
||||
|
||||
def _gen_rcsemxs(self):
|
||||
"""Génère les regroupements cohérents de RCFs qu'ont suivi chaque étudiant"""
|
||||
@ -423,34 +430,40 @@ class JuryPE(object):
|
||||
|
||||
# Intègre le bilan des trajectoires tagguées au zip final
|
||||
pe_affichage.pe_print("2) Bilan", info=True)
|
||||
output = io.BytesIO()
|
||||
with pd.ExcelWriter( # pylint: disable=abstract-class-instantiated
|
||||
output, engine="openpyxl"
|
||||
) as writer:
|
||||
onglets = []
|
||||
for rcs_tag in self.rcsstags.values():
|
||||
if rcs_tag.is_significatif():
|
||||
onglet = rcs_tag.get_repr(verbose=False)
|
||||
onglets += ["📊" + onglet]
|
||||
if (
|
||||
"classeurs_detailles" in self.options
|
||||
and self.options["classeurs_detailles"]
|
||||
):
|
||||
output = io.BytesIO()
|
||||
with pd.ExcelWriter( # pylint: disable=abstract-class-instantiated
|
||||
output, engine="openpyxl"
|
||||
) as writer:
|
||||
onglets = []
|
||||
for rcs_tag in self.rcsstags.values():
|
||||
if rcs_tag.is_significatif():
|
||||
onglet = rcs_tag.get_repr(verbose=False)
|
||||
onglets += ["📊" + onglet]
|
||||
|
||||
df = rcs_tag.to_df(options=self.options)
|
||||
# Conversion colonnes en multiindex
|
||||
df = convert_colonnes_to_multiindex(df)
|
||||
onglets += ["📊" + onglet]
|
||||
# écriture dans l'onglet
|
||||
df.to_excel(writer, onglet, index=True, header=True)
|
||||
pe_affichage.pe_print(
|
||||
f"--> Export excel de {', '.join(onglets)}", info=True
|
||||
)
|
||||
output.seek(0)
|
||||
df = rcs_tag.to_df(options=self.options)
|
||||
# Conversion colonnes en multiindex
|
||||
df = convert_colonnes_to_multiindex(df)
|
||||
onglets += ["📊" + onglet]
|
||||
# écriture dans l'onglet
|
||||
df.to_excel(writer, onglet, index=True, header=True)
|
||||
pe_affichage.pe_print(
|
||||
f"--> Export excel de {', '.join(onglets)}", info=True
|
||||
)
|
||||
output.seek(0)
|
||||
|
||||
if onglets:
|
||||
self.add_file_to_zip(
|
||||
zipfile,
|
||||
f"RCRCFs_{self.diplome}.xlsx",
|
||||
output.read(),
|
||||
path="details",
|
||||
)
|
||||
if onglets:
|
||||
self.add_file_to_zip(
|
||||
zipfile,
|
||||
f"RCRCFs_{self.diplome}.xlsx",
|
||||
output.read(),
|
||||
path="details",
|
||||
)
|
||||
else:
|
||||
pe_affichage.pe_print("--> Pas d'export Excel (option non cochée)")
|
||||
|
||||
def _gen_xls_interclasstags(self, zipfile: ZipFile):
|
||||
"""Génère les interclassements sur la promo de diplômés
|
||||
@ -512,36 +525,44 @@ class JuryPE(object):
|
||||
] = interclass
|
||||
|
||||
# Intègre le bilan des aggrégats (interclassé par promo) au zip final
|
||||
output = io.BytesIO()
|
||||
with pd.ExcelWriter( # pylint: disable=abstract-class-instantiated
|
||||
output, engine="openpyxl"
|
||||
) as writer:
|
||||
onglets = []
|
||||
for (
|
||||
type_interclass
|
||||
) in self.interclasstags: # Pour les types d'interclassements prévus
|
||||
interclasstag = self.interclasstags[type_interclass]
|
||||
for nom_rcs, interclass in interclasstag.items():
|
||||
if interclass.is_significatif():
|
||||
onglet = interclass.get_repr()
|
||||
onglets += ["📊" + onglet]
|
||||
df = interclass.to_df(cohorte="Promo", options=self.options)
|
||||
# Conversion colonnes en multiindex
|
||||
df = convert_colonnes_to_multiindex(df)
|
||||
onglets += [onglet]
|
||||
# écriture dans l'onglet
|
||||
df.to_excel(writer, onglet, index=True, header=True)
|
||||
pe_affichage.pe_print(f"=> Export excel de {', '.join(onglets)}", info=True)
|
||||
if (
|
||||
"classeurs_detailles" in self.options
|
||||
and self.options["classeurs_detailles"]
|
||||
):
|
||||
output = io.BytesIO()
|
||||
with pd.ExcelWriter( # pylint: disable=abstract-class-instantiated
|
||||
output, engine="openpyxl"
|
||||
) as writer:
|
||||
onglets = []
|
||||
for (
|
||||
type_interclass
|
||||
) in self.interclasstags: # Pour les types d'interclassements prévus
|
||||
interclasstag = self.interclasstags[type_interclass]
|
||||
for nom_rcs, interclass in interclasstag.items():
|
||||
if interclass.is_significatif():
|
||||
onglet = interclass.get_repr()
|
||||
onglets += ["📊" + onglet]
|
||||
df = interclass.to_df(cohorte="Promo", options=self.options)
|
||||
# Conversion colonnes en multiindex
|
||||
df = convert_colonnes_to_multiindex(df)
|
||||
onglets += [onglet]
|
||||
# écriture dans l'onglet
|
||||
df.to_excel(writer, onglet, index=True, header=True)
|
||||
pe_affichage.pe_print(
|
||||
f"=> Export excel de {', '.join(onglets)}", info=True
|
||||
)
|
||||
|
||||
output.seek(0)
|
||||
output.seek(0)
|
||||
|
||||
if onglets:
|
||||
self.add_file_to_zip(
|
||||
zipfile,
|
||||
f"InterClassTags_{self.diplome}.xlsx",
|
||||
output.read(),
|
||||
path="details",
|
||||
)
|
||||
if onglets:
|
||||
self.add_file_to_zip(
|
||||
zipfile,
|
||||
f"InterClassTags_{self.diplome}.xlsx",
|
||||
output.read(),
|
||||
path="details",
|
||||
)
|
||||
else:
|
||||
pe_affichage.pe_print("--> Pas d'export Excel (option non cochée)")
|
||||
|
||||
def _gen_xls_synthese_jury_par_tag(self, zipfile: ZipFile):
|
||||
"""Synthèse des éléments du jury PE tag par tag"""
|
||||
|
Loading…
Reference in New Issue
Block a user