From e63cdba1f66d79cd0f4ad8302bda09c4d894d1ec Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 7 Jul 2024 22:07:27 +0200 Subject: [PATCH] =?UTF-8?q?DUT=20apr=C3=A8s=20jury=20BUT:=20ajout=20sur=20?= =?UTF-8?q?bulletins=20et=20PVs.=20WIP=20#577?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/but/bulletin_but.py | 1 - app/but/bulletin_but_court.py | 3 ++- app/but/bulletin_but_court_pdf.py | 23 ++++++++++++++------ app/but/jury_but_pv.py | 10 ++++++++- app/scodoc/sco_bulletins.py | 8 +++++++ app/scodoc/sco_bulletins_json.py | 5 ++++- app/scodoc/sco_preferences.py | 2 +- app/scodoc/sco_pv_lettres_inviduelles.py | 27 ++++++++++++++++++++++-- app/templates/but/bulletin_court_page.j2 | 7 ++++-- 9 files changed, 70 insertions(+), 16 deletions(-) diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index 6e6c9d407..024fe53ed 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -576,7 +576,6 @@ class BulletinBUT: show_uevalid=self.prefs["bul_show_uevalid"], show_mention=self.prefs["bul_show_mention"], ) - d.update(infos) # --- Rangs d["rang_nt"] = ( diff --git a/app/but/bulletin_but_court.py b/app/but/bulletin_but_court.py index 41f989a11..d9772d630 100644 --- a/app/but/bulletin_but_court.py +++ b/app/but/bulletin_but_court.py @@ -39,6 +39,7 @@ from app.scodoc.codes_cursus import UE_STANDARD from app.scodoc.sco_exceptions import ScoNoReferentielCompetences, ScoValueError from app.scodoc.sco_logos import find_logo from app.scodoc.sco_permissions import Permission +from app.scodoc.sco_pv_lettres_inviduelles import add_dut120_infos import app.scodoc.sco_utils as scu from app.views import notes_bp as bp from app.views import ScoData @@ -67,7 +68,6 @@ def bulletin_but(formsemestre_id: int, etudid: int = None, fmt="html"): raise ScoValueError("formation non BUT") args = _build_bulletin_but_infos(etud, formsemestre, fmt=fmt) - if fmt == "pdf": filename = scu.bul_filename(formsemestre, etud, prefix="bul-but") bul_pdf = bulletin_but_court_pdf.make_bulletin_but_court_pdf(args) @@ -153,4 +153,5 @@ def _build_bulletin_but_infos( if ue.type == UE_STANDARD and ue.acronyme in ue_acronyms ], } + add_dut120_infos(formsemestre, etud.id, args) return args diff --git a/app/but/bulletin_but_court_pdf.py b/app/but/bulletin_but_court_pdf.py index 5acbee5df..041feef1e 100644 --- a/app/but/bulletin_but_court_pdf.py +++ b/app/but/bulletin_but_court_pdf.py @@ -97,6 +97,8 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard): tuple[int, str], ScolarFormSemestreValidation ] = None, ues_acronyms: list[str] = None, + diplome_dut120: bool = False, + diplome_dut120_descr: str = "", ): super().__init__(bul, authuser=current_user, filigranne=filigranne) self.bul = bul @@ -110,7 +112,8 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard): self.title = title self.ue_validation_by_niveau = ue_validation_by_niveau self.ues_acronyms = ues_acronyms # sans UEs sport - + self.diplome_dut120 = diplome_dut120 + self.diplome_dut120_descr = diplome_dut120_descr self.nb_ues = len(self.ues_acronyms) # Styles PDF self.style_base = styles.ParagraphStyle("style_base") @@ -243,13 +246,17 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard): ) table_abs_ues.hAlign = "RIGHT" # Ligne (en bas) avec table cursus et boite jury + # table_content = [self.table_cursus_but()] + # if self.prefs["bul_show_decision"]: + # table_content.append([Spacer(1, 8 * mm), self.boite_decisions_jury()]) + table_content = [self.table_cursus_but()] + table_content.append( + [Spacer(1, 8 * mm), self.boite_decisions_jury()] + if self.prefs["bul_show_decision"] + else [] + ) table_cursus_jury = Table( - [ - [ - self.table_cursus_but(), - [Spacer(1, 8 * mm), self.boite_decisions_jury()], - ] - ], + [table_content], colWidths=(self.width_page_avail - 84 * mm, 84 * mm), style=style_table_2cols, ) @@ -533,6 +540,8 @@ class BulletinGeneratorBUTCourt(BulletinGeneratorStandard):
{self.bul["diplomation"]} """ + if self.diplome_dut120_descr: + txt += f"""
{self.diplome_dut120_descr}.""" if self.bul["semestre"].get("autorisation_inscription", None): txt += ( diff --git a/app/but/jury_but_pv.py b/app/but/jury_but_pv.py index 22aca962e..1bc5a8d38 100644 --- a/app/but/jury_but_pv.py +++ b/app/but/jury_but_pv.py @@ -13,6 +13,7 @@ from openpyxl.styles import Alignment from app import log from app.but import jury_but from app.but.cursus_but import but_ects_valides +from app.models.but_validations import ValidationDUT120 from app.models.etudiants import Identite from app.models.formsemestre import FormSemestre from app.scodoc.gen_tables import GenTable @@ -156,6 +157,13 @@ def pvjury_table_but( ects_but_valides = but_ects_valides(etud, referentiel_competence_id) has_diplome = deca.valide_diplome() + diplome_lst = ["ADM"] if has_diplome else [] + validation_dut120 = ValidationDUT120.query.filter_by( + etudid=etudid, formsemestre_id=formsemestre.id + ).first() + if validation_dut120: + diplome_lst.append("Diplôme de DUT validé.") + diplome_str = ". ".join(diplome_lst) row = { "nom_pv": ( etud.code_ine or etud.code_nip or etud.id @@ -190,7 +198,7 @@ def pvjury_table_but( else "" ) ), - "diplome": "ADM" if has_diplome else "", + "diplome": diplome_str, # pour exports excel seulement: "civilite": etud.civilite_etat_civil_str, "nom": etud.nom, diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index a24785ee1..2ca0632f3 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -69,6 +69,7 @@ from app.scodoc import sco_formsemestre from app.scodoc import sco_groups from app.scodoc import sco_preferences from app.scodoc import sco_pv_dict +from app.scodoc import sco_pv_lettres_inviduelles from app.scodoc import sco_users import app.scodoc.sco_utils as scu from app.scodoc.sco_utils import ModuleType, fmt_note @@ -711,6 +712,9 @@ def etud_descr_situation_semestre( descr_mention : 'Mention Bien', ou vide si pas de mention ou si pas show_mention diplomation : "Diplôme obtenu." ou "" parcours_titre, parcours_code, refcomp_specialite, refcomp_specialite_long + + diplome_dut120_descr: phrase explicative si DUT enregistré (en BUT) + diplome_dut120: booléen, vrai si DUT enregistré (en BUT) """ # Fonction utilisée par tous les bulletins (APC ou classiques) infos = collections.defaultdict(str) @@ -830,12 +834,16 @@ def etud_descr_situation_semestre( descr_dec += " Diplôme obtenu." infos["diplomation"] = "Diplôme obtenu." if pv["validation_parcours"] else "" + # Ajoute diplome_dut120_descr et diplome_dut120 + sco_pv_lettres_inviduelles.add_dut120_infos(formsemestre, etudid, infos) + _format_situation_fields( infos, [ "descr_inscription", "descr_defaillance", "descr_decisions_ue", + "diplome_dut120_descr", "descr_decision_annee", ], [descr_dec, descr_mention, descr_autorisations], diff --git a/app/scodoc/sco_bulletins_json.py b/app/scodoc/sco_bulletins_json.py index 8fa0d38b2..46383b0d1 100644 --- a/app/scodoc/sco_bulletins_json.py +++ b/app/scodoc/sco_bulletins_json.py @@ -447,6 +447,7 @@ def dict_decision_jury( 'situation': 'Inscrit le 25/06/2021. Décision jury: Validé. UE acquises: ' 'UE31, UE32. Diplôme obtenu.', 'diplomation' : 'Diplôme obtenu.' # (ou vide) + } """ from app.scodoc import sco_bulletins @@ -460,8 +461,10 @@ def dict_decision_jury( formsemestre, show_uevalid=prefs["bul_show_uevalid"], ) - d["situation"] = infos["situation"] d["diplomation"] = infos["diplomation"] + d["situation"] = infos["situation"] + d["diplome_dut120"] = infos["diplome_dut120"] + d["diplome_dut120_descr"] = infos["diplome_dut120_descr"] if dpv: decision = dpv["decisions"][0] etat = decision["etat"] diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py index 106e541bf..019cec658 100644 --- a/app/scodoc/sco_preferences.py +++ b/app/scodoc/sco_preferences.py @@ -1350,7 +1350,7 @@ class BasePreferences: "bul_show_decision", { "initvalue": 0, - "title": "Faire figurer les décisions sur les bulletins", + "title": "Faire figurer les décisions de jury sur les bulletins", "input_type": "boolcheckbox", "category": "bul", "labels": ["non", "oui"], diff --git a/app/scodoc/sco_pv_lettres_inviduelles.py b/app/scodoc/sco_pv_lettres_inviduelles.py index 6e335f0a2..053eed1bf 100644 --- a/app/scodoc/sco_pv_lettres_inviduelles.py +++ b/app/scodoc/sco_pv_lettres_inviduelles.py @@ -43,7 +43,7 @@ from reportlab.platypus.doctemplate import BaseDocTemplate from reportlab.lib import styles from app import db -from app.models import FormSemestre, Identite +from app.models import FormSemestre, Identite, ValidationDUT120 import app.scodoc.sco_utils as scu from app.scodoc import sco_bulletins_pdf @@ -347,7 +347,9 @@ def add_classic_infos(formsemestre: FormSemestre, params: dict, decision: dict): def add_apc_infos(formsemestre: FormSemestre, params: dict, decision: dict): - """Ajoute les champs pour les formations APC (BUT), donc avec codes RCUE et année""" + """Ajoute à params les champs pour les formations APC (BUT), avec codes RCUE et année + et diplome_dut120_descr + """ annee_but = (formsemestre.semestre_id + 1) // 2 params["decision_orig"] = f"année BUT{annee_but}" if decision is None: @@ -364,3 +366,24 @@ def add_apc_infos(formsemestre: FormSemestre, params: dict, decision: dict): '
    - '.join( decision.get("descr_decisions_rcue_list", []) ) } """ + add_dut120_infos(formsemestre, decision["identite"]["etudid"], params) + + +def add_dut120_infos(formsemestre: FormSemestre, etudid: int, params: dict): + """Ajout DUT120: + diplome_dut120_descr: phrase explicative si DUT enregistré + diplome_dut120: booléen, vrai si DUT enregistré + """ + validation_dut120 = ValidationDUT120.query.filter_by( + etudid=etudid, formsemestre_id=formsemestre.id + ).first() + if validation_dut120: + params["diplome_dut120"] = True + params["diplome_dut120_descr"] = "Diplôme de DUT (BUT1, BUT2) validé" + if "decision_sem_descr" in params: + # sur decision_sem_descr afin que cela apparaisse sur les + # lettres individuelles sans avoir à modifier le paramétrage + params["decision_sem_descr"] += ". " + params["diplome_dut120_descr"] + else: + params["diplome_dut120"] = False + params["diplome_dut120_descr"] = "" diff --git a/app/templates/but/bulletin_court_page.j2 b/app/templates/but/bulletin_court_page.j2 index 6912ee721..95180ff83 100644 --- a/app/templates/but/bulletin_court_page.j2 +++ b/app/templates/but/bulletin_court_page.j2 @@ -133,13 +133,16 @@
ECTS acquis en BUT : {{"%g"|format(ects_total)}}
{% if bul.semestre.decision_annee %} - Décision saisie le {{ + {# Décision saisie le {{ datetime.datetime.fromisoformat(bul.semestre.decision_annee.date).strftime(scu.DATE_FMT) - }}, + }}, #} année BUT{{bul.semestre.decision_annee.ordre}} {{bul.semestre.decision_annee.code}}. {% endif %}
{{bul.semestre.diplomation}}
+ {% if diplome_dut120_descr %} +
{{diplome_dut120_descr}}.
+ {% endif %} {% set virg = joiner(", ") %} {% for aut in bul.semestre.autorisation_inscription -%} {% if loop.first %}