Réglage publication bulletin JSON
This commit is contained in:
parent
a78bb4bc1c
commit
4133b9df6a
@ -219,13 +219,18 @@ class ResultatsSemestreBUT:
|
||||
}
|
||||
return d
|
||||
|
||||
def bulletin_etud(self, etud, formsemestre) -> dict:
|
||||
"""Le bulletin de l'étudiant dans ce semestre"""
|
||||
def bulletin_etud(self, etud, formsemestre, force_publishing=False) -> dict:
|
||||
"""Le bulletin de l'étudiant dans ce semestre.
|
||||
Si force_publishing, rempli le bulletin même si bul_hide_xml est vrai
|
||||
(bulletins non publiés).
|
||||
"""
|
||||
etat_inscription = etud.etat_inscription(formsemestre.id)
|
||||
published = (not formsemestre.bul_hide_xml) or force_publishing
|
||||
d = {
|
||||
"version": "0",
|
||||
"type": "BUT",
|
||||
"date": datetime.datetime.utcnow().isoformat() + "Z",
|
||||
"publie": not formsemestre.bul_hide_xml,
|
||||
"etudiant": etud.to_dict_bul(),
|
||||
"formation": {
|
||||
"id": formsemestre.formation.id,
|
||||
@ -237,6 +242,8 @@ class ResultatsSemestreBUT:
|
||||
"etat_inscription": etat_inscription,
|
||||
"options": bulletin_option_affichage(formsemestre),
|
||||
}
|
||||
if not published:
|
||||
return d
|
||||
semestre_infos = {
|
||||
"etapes": [str(x.etape_apo) for x in formsemestre.etapes if x.etape_apo],
|
||||
"date_debut": formsemestre.date_debut.isoformat(),
|
||||
|
@ -98,9 +98,9 @@ def formsemestre_bulletinetud_published_dict(
|
||||
d = {}
|
||||
|
||||
if (not sem["bul_hide_xml"]) or force_publishing:
|
||||
published = 1
|
||||
published = True
|
||||
else:
|
||||
published = 0
|
||||
published = False
|
||||
if xml_nodate:
|
||||
docdate = ""
|
||||
else:
|
||||
|
@ -307,7 +307,9 @@ def formsemestre_bulletinetud(
|
||||
)
|
||||
if format == "json":
|
||||
r = bulletin_but.ResultatsSemestreBUT(formsemestre)
|
||||
return jsonify(r.bulletin_etud(etud, formsemestre))
|
||||
return jsonify(
|
||||
r.bulletin_etud(etud, formsemestre, force_publishing=force_publishing)
|
||||
)
|
||||
elif format == "html":
|
||||
return render_template(
|
||||
"but/bulletin.html",
|
||||
@ -318,6 +320,7 @@ def formsemestre_bulletinetud(
|
||||
formsemestre_id=formsemestre_id,
|
||||
etudid=etudid,
|
||||
format="json",
|
||||
force_publishing=1, # pour ScoDoc lui même
|
||||
),
|
||||
sco=ScoData(),
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.1.32"
|
||||
SCOVERSION = "9.1.33"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user