From 593317a50aa4025e308fe59e1b2d356a01c1edf2 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 17 Dec 2021 21:59:28 +0100 Subject: [PATCH] Export recapcomplet json: format BUT --- app/scodoc/sco_recapcomplet.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/scodoc/sco_recapcomplet.py b/app/scodoc/sco_recapcomplet.py index 34f1aee794..d3f7f6f4a6 100644 --- a/app/scodoc/sco_recapcomplet.py +++ b/app/scodoc/sco_recapcomplet.py @@ -37,7 +37,8 @@ from flask import make_response from app import log from app.but import bulletin_but -from app.models import FormSemestre, UniteEns, Module, ModuleImpl +from app.models import FormSemestre +from app.models.etudiants import Identite import app.scodoc.sco_utils as scu from app.scodoc import html_sco_header @@ -937,6 +938,9 @@ def _formsemestre_recapcomplet_json( :param force_publishing: donne les bulletins même si non "publiés sur portail" :returns: dict, "", "json" """ + formsemestre = FormSemestre.query.get_or_404(formsemestre_id) + is_apc = formsemestre.formation.is_apc() + if xml_nodate: docdate = "" else: @@ -958,14 +962,18 @@ def _formsemestre_recapcomplet_json( T = nt.get_table_moyennes_triees() for t in T: etudid = t[-1] - bulletins.append( - sco_bulletins_json.formsemestre_bulletinetud_published_dict( + if is_apc: + etud = Identite.query.get(etudid) + r = bulletin_but.ResultatsSemestreBUT(formsemestre) + bul = r.bulletin_etud(etud, formsemestre) + else: + bul = sco_bulletins_json.formsemestre_bulletinetud_published_dict( formsemestre_id, etudid, force_publishing=force_publishing, xml_with_decisions=xml_with_decisions, ) - ) + bulletins.append(bul) return J, "", "json"