Fix: anciens bulletins XML du BUT des démissionnaires

This commit is contained in:
Emmanuel Viennet 2022-01-09 10:11:50 +01:00
parent 9172282451
commit 68dec8e1f8

View File

@ -68,11 +68,12 @@ def bulletin_but_xml_compat(
"bulletin_but_xml_compat( formsemestre_id=%s, etudid=%s )"
% (formsemestre_id, etudid)
)
sem = FormSemestre.query.get_or_404(formsemestre_id)
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
etud = Identite.query.get_or_404(etudid)
results = bulletin_but.ResultatsSemestreBUT(sem)
results = bulletin_but.ResultatsSemestreBUT(formsemestre)
nb_inscrits = len(results.etuds)
if (not sem.bul_hide_xml) or force_publishing:
etat_inscription = etud.etat_inscription(formsemestre.id)
if (not formsemestre.bul_hide_xml) or force_publishing:
published = 1
else:
published = 0
@ -86,10 +87,10 @@ def bulletin_but_xml_compat(
"date": docdate,
"publie": str(published),
}
if sem.etapes:
el["etape_apo"] = sem.etapes[0].etape_apo or ""
if formsemestre.etapes:
el["etape_apo"] = formsemestre.etapes[0].etape_apo or ""
n = 2
for et in sem.etapes[1:]:
for et in formsemestre.etapes[1:]:
el["etape_apo" + str(n)] = et.etape_apo or ""
n += 1
x = Element("bulletinetud", **el)
@ -120,6 +121,8 @@ def bulletin_but_xml_compat(
return sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(
scu.SCO_ENCODING
) # stop !
if etat_inscription == scu.INSCRIT:
# Moyenne générale:
doc.append(
Element(
@ -180,7 +183,9 @@ def bulletin_but_xml_compat(
numero=str(modimpl.module.numero or 0),
titre=scu.quote_xml_attr(modimpl.module.titre or ""),
abbrev=scu.quote_xml_attr(modimpl.module.abbrev or ""),
code_apogee=scu.quote_xml_attr(modimpl.module.code_apogee or ""),
code_apogee=scu.quote_xml_attr(
modimpl.module.code_apogee or ""
),
)
x_ue.append(x_mod)
x_mod.append(
@ -218,9 +223,9 @@ def bulletin_but_xml_compat(
Element(
"note",
value=scu.fmt_note(
results.modimpls_evals_notes[e.moduleimpl_id][
e.id
][etud.id],
results.modimpls_evals_notes[
e.moduleimpl_id
][e.id][etud.id],
note_max=e.note_max,
),
)
@ -230,7 +235,7 @@ def bulletin_but_xml_compat(
# --- Absences
if sco_preferences.get_preference("bul_show_abs", formsemestre_id):
nbabs, nbabsjust = sem.get_abs_count(etud.id)
nbabs, nbabsjust = formsemestre.get_abs_count(etud.id)
doc.append(Element("absences", nbabs=str(nbabs), nbabsjust=str(nbabsjust)))
# -------- LA SUITE EST COPIEE SANS MODIF DE sco_bulletins_xml.py ---------