From 1de8cf4056ad778e3c495536dd69cca68688f67f Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 22 Aug 2021 17:18:15 +0200 Subject: [PATCH] Fix: archive documents jury --- app/scodoc/sco_archives.py | 2 ++ app/scodoc/sco_bulletins_xml.py | 22 +++++++++++----------- app/scodoc/sco_recapcomplet.py | 17 ++++++++++++++--- app/views/notes.py | 1 + 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/app/scodoc/sco_archives.py b/app/scodoc/sco_archives.py index 66c8c2d7eb..5567b4c762 100644 --- a/app/scodoc/sco_archives.py +++ b/app/scodoc/sco_archives.py @@ -318,6 +318,7 @@ def do_formsemestre_archive( html_sco_header.sco_footer(), ] ) + data = data.encode(scu.SCO_ENCODING) PVArchive.store(archive_id, "Tableau_moyennes.html", data) # 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 ) if data: + data = data.encode(scu.SCO_ENCODING) PVArchive.store(archive_id, "Bulletins.xml", data) # Decisions de jury, en XLS data = sco_pvjury.formsemestre_pvjury( diff --git a/app/scodoc/sco_bulletins_xml.py b/app/scodoc/sco_bulletins_xml.py index 7b456e4f83..3d4bb109dd 100644 --- a/app/scodoc/sco_bulletins_xml.py +++ b/app/scodoc/sco_bulletins_xml.py @@ -91,8 +91,8 @@ def make_xml_formsemestre_bulletinetud( docdate = datetime.datetime.now().isoformat() el = { - "etudid": etudid, - "formsemestre_id": formsemestre_id, + "etudid": str(etudid), + "formsemestre_id": str(formsemestre_id), "date": docdate, "publie": published, } @@ -115,9 +115,9 @@ def make_xml_formsemestre_bulletinetud( doc.append( Element( "etudiant", - etudid=etudid, - code_nip=etudinfo["code_nip"], - code_ine=etudinfo["code_ine"], + etudid=str(etudid), + code_nip=str(etudinfo["code_nip"]), + code_ine=str(etudinfo["code_ine"]), nom=scu.quote_xml_attr(etudinfo["nom"]), prenom=scu.quote_xml_attr(etudinfo["prenom"]), 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"]) x_ue = Element( "ue", - id=ue["ue_id"], + id=str(ue["ue_id"]), numero=scu.quote_xml_attr(ue["numero"]), acronyme=scu.quote_xml_attr(ue["acronyme"]), titre=scu.quote_xml_attr(ue["titre"]), @@ -229,8 +229,8 @@ def make_xml_formsemestre_bulletinetud( # ects = str(mod['ects']) x_mod = Element( "module", - id=modimpl["moduleimpl_id"], - code=mod["code"], + id=str(modimpl["moduleimpl_id"]), + code=str(mod["code"]), coefficient=str(mod["coefficient"]), numero=str(mod["numero"]), titre=scu.quote_xml_attr(mod["titre"]), @@ -322,7 +322,7 @@ def make_xml_formsemestre_bulletinetud( ects_txt = "" x_ue = Element( "ue_capitalisee", - id=ue["ue_id"], + id=str(ue["ue_id"]), numero=scu.quote_xml_attr(ue["numero"]), acronyme=scu.quote_xml_attr(ue["acronyme"]), titre=scu.quote_xml_attr(ue["titre"]), @@ -343,7 +343,7 @@ def make_xml_formsemestre_bulletinetud( # --- Absences if sco_preferences.get_preference("bul_show_abs", formsemestre_id): 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 if ( sco_preferences.get_preference("bul_show_decision", formsemestre_id) @@ -392,7 +392,7 @@ def make_xml_formsemestre_bulletinetud( doc.append( Element( "decision_ue", - ue_id=ue["ue_id"], + ue_id=str(ue["ue_id"]), numero=scu.quote_xml_attr(ue["numero"]), acronyme=scu.quote_xml_attr(ue["acronyme"]), titre=scu.quote_xml_attr(ue["titre"]), diff --git a/app/scodoc/sco_recapcomplet.py b/app/scodoc/sco_recapcomplet.py index fa4484afd6..02bacda949 100644 --- a/app/scodoc/sco_recapcomplet.py +++ b/app/scodoc/sco_recapcomplet.py @@ -211,7 +211,19 @@ def do_formsemestre_recapcomplet( force_publishing=True, ): """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": return data elif format == "csv": @@ -225,7 +237,6 @@ def do_formsemestre_recapcomplet( def make_formsemestre_recapcomplet( - REQUEST=None, formsemestre_id=None, format="html", # html, xml, xls, xlsall, json hidemodules=False, # ne pas montrer les modules (ignoré en XML) @@ -870,7 +881,7 @@ def _formsemestre_recapcomplet_xml( else: docdate = datetime.datetime.now().isoformat() 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) doc.append( diff --git a/app/views/notes.py b/app/views/notes.py index a324f433b4..e60fdfacd1 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -2209,6 +2209,7 @@ sco_publish( "/formsemestre_delete_archive", sco_archives.formsemestre_delete_archive, Permission.ScoView, + methods=["GET", "POST"], ) sco_publish( "/formsemestre_list_archives",