Fix: archive documents jury

This commit is contained in:
Emmanuel Viennet 2021-08-22 17:18:15 +02:00
parent cffcaa03ce
commit 1de8cf4056
4 changed files with 28 additions and 14 deletions

View File

@ -318,6 +318,7 @@ def do_formsemestre_archive(
html_sco_header.sco_footer(), html_sco_header.sco_footer(),
] ]
) )
data = data.encode(scu.SCO_ENCODING)
PVArchive.store(archive_id, "Tableau_moyennes.html", data) PVArchive.store(archive_id, "Tableau_moyennes.html", data)
# Bulletins en XML (pour tous les etudiants, n'utilise pas les groupes) # Bulletins en XML (pour tous les etudiants, n'utilise pas les groupes)
@ -325,6 +326,7 @@ def do_formsemestre_archive(
formsemestre_id, format="xml", xml_with_decisions=True formsemestre_id, format="xml", xml_with_decisions=True
) )
if data: if data:
data = data.encode(scu.SCO_ENCODING)
PVArchive.store(archive_id, "Bulletins.xml", data) PVArchive.store(archive_id, "Bulletins.xml", data)
# Decisions de jury, en XLS # Decisions de jury, en XLS
data = sco_pvjury.formsemestre_pvjury( data = sco_pvjury.formsemestre_pvjury(

View File

@ -91,8 +91,8 @@ def make_xml_formsemestre_bulletinetud(
docdate = datetime.datetime.now().isoformat() docdate = datetime.datetime.now().isoformat()
el = { el = {
"etudid": etudid, "etudid": str(etudid),
"formsemestre_id": formsemestre_id, "formsemestre_id": str(formsemestre_id),
"date": docdate, "date": docdate,
"publie": published, "publie": published,
} }
@ -115,9 +115,9 @@ def make_xml_formsemestre_bulletinetud(
doc.append( doc.append(
Element( Element(
"etudiant", "etudiant",
etudid=etudid, etudid=str(etudid),
code_nip=etudinfo["code_nip"], code_nip=str(etudinfo["code_nip"]),
code_ine=etudinfo["code_ine"], code_ine=str(etudinfo["code_ine"]),
nom=scu.quote_xml_attr(etudinfo["nom"]), nom=scu.quote_xml_attr(etudinfo["nom"]),
prenom=scu.quote_xml_attr(etudinfo["prenom"]), prenom=scu.quote_xml_attr(etudinfo["prenom"]),
civilite=scu.quote_xml_attr(etudinfo["civilite_str"]), civilite=scu.quote_xml_attr(etudinfo["civilite_str"]),
@ -188,7 +188,7 @@ def make_xml_formsemestre_bulletinetud(
ue_status = nt.get_etud_ue_status(etudid, ue["ue_id"]) ue_status = nt.get_etud_ue_status(etudid, ue["ue_id"])
x_ue = Element( x_ue = Element(
"ue", "ue",
id=ue["ue_id"], id=str(ue["ue_id"]),
numero=scu.quote_xml_attr(ue["numero"]), numero=scu.quote_xml_attr(ue["numero"]),
acronyme=scu.quote_xml_attr(ue["acronyme"]), acronyme=scu.quote_xml_attr(ue["acronyme"]),
titre=scu.quote_xml_attr(ue["titre"]), titre=scu.quote_xml_attr(ue["titre"]),
@ -229,8 +229,8 @@ def make_xml_formsemestre_bulletinetud(
# ects = str(mod['ects']) # ects = str(mod['ects'])
x_mod = Element( x_mod = Element(
"module", "module",
id=modimpl["moduleimpl_id"], id=str(modimpl["moduleimpl_id"]),
code=mod["code"], code=str(mod["code"]),
coefficient=str(mod["coefficient"]), coefficient=str(mod["coefficient"]),
numero=str(mod["numero"]), numero=str(mod["numero"]),
titre=scu.quote_xml_attr(mod["titre"]), titre=scu.quote_xml_attr(mod["titre"]),
@ -322,7 +322,7 @@ def make_xml_formsemestre_bulletinetud(
ects_txt = "" ects_txt = ""
x_ue = Element( x_ue = Element(
"ue_capitalisee", "ue_capitalisee",
id=ue["ue_id"], id=str(ue["ue_id"]),
numero=scu.quote_xml_attr(ue["numero"]), numero=scu.quote_xml_attr(ue["numero"]),
acronyme=scu.quote_xml_attr(ue["acronyme"]), acronyme=scu.quote_xml_attr(ue["acronyme"]),
titre=scu.quote_xml_attr(ue["titre"]), titre=scu.quote_xml_attr(ue["titre"]),
@ -343,7 +343,7 @@ def make_xml_formsemestre_bulletinetud(
# --- Absences # --- Absences
if sco_preferences.get_preference("bul_show_abs", formsemestre_id): if sco_preferences.get_preference("bul_show_abs", formsemestre_id):
nbabs, nbabsjust = sco_abs.get_abs_count(etudid, sem) nbabs, nbabsjust = sco_abs.get_abs_count(etudid, sem)
doc.append(Element("absences", nbabs=nbabs, nbabsjust=nbabsjust)) doc.append(Element("absences", nbabs=str(nbabs), nbabsjust=str(nbabsjust)))
# --- Decision Jury # --- Decision Jury
if ( if (
sco_preferences.get_preference("bul_show_decision", formsemestre_id) sco_preferences.get_preference("bul_show_decision", formsemestre_id)
@ -392,7 +392,7 @@ def make_xml_formsemestre_bulletinetud(
doc.append( doc.append(
Element( Element(
"decision_ue", "decision_ue",
ue_id=ue["ue_id"], ue_id=str(ue["ue_id"]),
numero=scu.quote_xml_attr(ue["numero"]), numero=scu.quote_xml_attr(ue["numero"]),
acronyme=scu.quote_xml_attr(ue["acronyme"]), acronyme=scu.quote_xml_attr(ue["acronyme"]),
titre=scu.quote_xml_attr(ue["titre"]), titre=scu.quote_xml_attr(ue["titre"]),

View File

@ -211,7 +211,19 @@ def do_formsemestre_recapcomplet(
force_publishing=True, force_publishing=True,
): ):
"""Calcule et renvoie le tableau récapitulatif.""" """Calcule et renvoie le tableau récapitulatif."""
data, filename, format = make_formsemestre_recapcomplet(**vars()) data, filename, format = make_formsemestre_recapcomplet(
formsemestre_id=formsemestre_id,
format=format,
hidemodules=hidemodules,
hidebac=hidebac,
xml_nodate=xml_nodate,
modejury=modejury,
sortcol=sortcol,
xml_with_decisions=xml_with_decisions,
disable_etudlink=disable_etudlink,
rank_partition_id=rank_partition_id,
force_publishing=force_publishing,
)
if format == "xml" or format == "html": if format == "xml" or format == "html":
return data return data
elif format == "csv": elif format == "csv":
@ -225,7 +237,6 @@ def do_formsemestre_recapcomplet(
def make_formsemestre_recapcomplet( def make_formsemestre_recapcomplet(
REQUEST=None,
formsemestre_id=None, formsemestre_id=None,
format="html", # html, xml, xls, xlsall, json format="html", # html, xml, xls, xlsall, json
hidemodules=False, # ne pas montrer les modules (ignoré en XML) hidemodules=False, # ne pas montrer les modules (ignoré en XML)
@ -870,7 +881,7 @@ def _formsemestre_recapcomplet_xml(
else: else:
docdate = datetime.datetime.now().isoformat() docdate = datetime.datetime.now().isoformat()
doc = ElementTree.Element( doc = ElementTree.Element(
"recapsemestre", formsemestre_id=formsemestre_id, date=docdate "recapsemestre", formsemestre_id=str(formsemestre_id), date=docdate
) )
evals = sco_evaluations.do_evaluation_etat_in_sem(formsemestre_id) evals = sco_evaluations.do_evaluation_etat_in_sem(formsemestre_id)
doc.append( doc.append(

View File

@ -2209,6 +2209,7 @@ sco_publish(
"/formsemestre_delete_archive", "/formsemestre_delete_archive",
sco_archives.formsemestre_delete_archive, sco_archives.formsemestre_delete_archive,
Permission.ScoView, Permission.ScoView,
methods=["GET", "POST"],
) )
sco_publish( sco_publish(
"/formsemestre_list_archives", "/formsemestre_list_archives",