diff --git a/app/but/jury_but_pv.py b/app/but/jury_but_pv.py index 095c5efc..ca7f33b8 100644 --- a/app/but/jury_but_pv.py +++ b/app/but/jury_but_pv.py @@ -38,7 +38,7 @@ def _descr_cursus_but(etud: Identite) -> str: return ", ".join(f"S{indice}" for indice in indices) -def pvjury_table_but(formsemestre_id: int, format="html") -> list[dict]: +def pvjury_table_but(formsemestre_id: int, format="html"): """Page récapitulant les décisions de jury BUT formsemestre peut être pair ou impair """ diff --git a/app/scodoc/sco_archives.py b/app/scodoc/sco_archives.py index 26ce9f8c..3d400f2e 100644 --- a/app/scodoc/sco_archives.py +++ b/app/scodoc/sco_archives.py @@ -65,6 +65,7 @@ from flask_login import current_user import app.scodoc.sco_utils as scu from config import Config from app import log +from app.but import jury_but_pv from app.comp import res_sem from app.comp.res_compat import NotesTableCompat from app.models import Departement, FormSemestre @@ -361,8 +362,14 @@ def do_formsemestre_archive( data_js = json.dumps(data, indent=1, cls=scu.ScoDocJSONEncoder) if data: PVArchive.store(archive_id, "Bulletins.json", data_js) - # Decisions de jury, en XLS - data = sco_pvjury.formsemestre_pvjury(formsemestre_id, format="xls", publish=False) + # Décisions de jury, en XLS + if formsemestre.formation.is_apc(): + response = jury_but_pv.pvjury_table_but(formsemestre_id, format="xls") + data = response.get_data() + else: # formations classiques + data = sco_pvjury.formsemestre_pvjury( + formsemestre_id, format="xls", publish=False + ) if data: PVArchive.store( archive_id, @@ -385,21 +392,24 @@ def do_formsemestre_archive( ) if data: PVArchive.store(archive_id, "CourriersDecisions%s.pdf" % groups_filename, data) - # PV de jury (PDF): - dpv = sco_pvjury.dict_pvjury(formsemestre_id, etudids=etudids, with_prev=True) - data = sco_pvpdf.pvjury_pdf( - dpv, - date_commission=date_commission, - date_jury=date_jury, - numeroArrete=numeroArrete, - VDICode=VDICode, - showTitle=showTitle, - pv_title=pv_title, - with_paragraph_nom=with_paragraph_nom, - anonymous=anonymous, - ) - if data: - PVArchive.store(archive_id, "PV_Jury%s.pdf" % groups_filename, data) + + # PV de jury (PDF): disponible seulement en classique + # en BUT, le PV est sous forme excel (Decisions_Jury.xlsx ci-dessus) + if not formsemestre.formation.is_apc(): + dpv = sco_pvjury.dict_pvjury(formsemestre_id, etudids=etudids, with_prev=True) + data = sco_pvpdf.pvjury_pdf( + dpv, + date_commission=date_commission, + date_jury=date_jury, + numeroArrete=numeroArrete, + VDICode=VDICode, + showTitle=showTitle, + pv_title=pv_title, + with_paragraph_nom=with_paragraph_nom, + anonymous=anonymous, + ) + if data: + PVArchive.store(archive_id, "PV_Jury%s.pdf" % groups_filename, data) def formsemestre_archive(formsemestre_id, group_ids=[]): diff --git a/app/scodoc/sco_pvjury.py b/app/scodoc/sco_pvjury.py index 651032c0..140234f5 100644 --- a/app/scodoc/sco_pvjury.py +++ b/app/scodoc/sco_pvjury.py @@ -206,6 +206,7 @@ def dict_pvjury( { 'date' : date de la decision la plus recente, 'formsemestre' : sem, + 'is_apc' : bool, 'formation' : { 'acronyme' :, 'titre': ... } 'decisions' : { [ { 'identite' : {'nom' :, 'prenom':, ...,}, 'etat' : I ou D ou DEF @@ -359,6 +360,7 @@ def dict_pvjury( return { "date": ndb.DateISOtoDMY(max_date), "formsemestre": sem, + "is_apc": nt.is_apc, "has_prev": has_prev, "semestre_non_terminal": semestre_non_terminal, "formation": sco_formations.formation_list( @@ -418,7 +420,10 @@ def pvjury_table( titles["prev_decision"] = "Décision S%s" % id_prev columns_ids += ["prev_decision"] - columns_ids += ["decision"] + if not dpv["is_apc"]: + # Décision de jury sur le semestre, sauf en BUT + columns_ids += ["decision"] + if sco_preferences.get_preference("bul_show_mention", formsemestre_id): columns_ids += ["mention"] columns_ids += ["ue_cap"] @@ -444,7 +449,7 @@ def pvjury_table( scodoc_dept=g.scodoc_dept, etudid=e["identite"]["etudid"], ), - "_nomprenom_td_attrs": 'id="%s" class="etudinfo"' % e["identite"]["etudid"], + "_nomprenom_td_attrs": f"""id="{e['identite']['etudid']}" class="etudinfo" """, "parcours": e["parcours"], "decision": _descr_decision_sem_abbrev(e["etat"], e["decision_sem"]), "ue_cap": e["decisions_ue_descr"], @@ -508,7 +513,8 @@ def formsemestre_pvjury(formsemestre_id, format="html", publish=True): # Bretelle provisoire pour BUT 9.3.0 # XXX TODO formsemestre = FormSemestre.query.get_or_404(formsemestre_id) - if formsemestre.formation.is_apc() and formsemestre.semestre_id % 2 == 0: + is_apc = formsemestre.formation.is_apc() + if format == "html" and is_apc and formsemestre.semestre_id % 2 == 0: from app.but import jury_but_recap return jury_but_recap.formsemestre_saisie_jury_but(