From d1074a8227ebef91c33bf81b2ec586bb2eac75a0 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 26 Jan 2024 16:14:08 +0100 Subject: [PATCH] =?UTF-8?q?BUT:=20Option=20pour=20ne=20pas=20afficher=20d?= =?UTF-8?q?=C3=A9cision=20annuelle=20sur=20bulletins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/but_validations.py | 22 +++++++++++++--------- app/scodoc/sco_bulletins.py | 4 +++- app/scodoc/sco_formations.py | 4 ++-- app/scodoc/sco_formsemestre_edit.py | 4 +++- app/scodoc/sco_preferences.py | 15 +++++++++++++-- 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/app/models/but_validations.py b/app/models/but_validations.py index 9a6953b94..fb3ade82d 100644 --- a/app/models/but_validations.py +++ b/app/models/but_validations.py @@ -9,6 +9,7 @@ from app.models.but_refcomp import ApcNiveau from app.models.etudiants import Identite from app.models.formsemestre import FormSemestre from app.models.ues import UniteEns +from app.scodoc import sco_preferences class ApcValidationRCUE(db.Model): @@ -218,15 +219,18 @@ def dict_decision_jury(etud: Identite, formsemestre: FormSemestre) -> dict: decisions["descr_decisions_rcue"] = "" decisions["descr_decisions_niveaux"] = "" # --- Année: prend la validation pour l'année scolaire et l'ordre de ce semestre - annee_but = (formsemestre.semestre_id + 1) // 2 - validation = ApcValidationAnnee.query.filter_by( - etudid=etud.id, - annee_scolaire=formsemestre.annee_scolaire(), - ordre=annee_but, - referentiel_competence_id=formsemestre.formation.referentiel_competence_id, - ).first() - if validation: - decisions["decision_annee"] = validation.to_dict_bul() + if sco_preferences.get_preference("bul_but_code_annuel", formsemestre.id): + annee_but = (formsemestre.semestre_id + 1) // 2 + validation = ApcValidationAnnee.query.filter_by( + etudid=etud.id, + annee_scolaire=formsemestre.annee_scolaire(), + ordre=annee_but, + referentiel_competence_id=formsemestre.formation.referentiel_competence_id, + ).first() + if validation: + decisions["decision_annee"] = validation.to_dict_bul() + else: + decisions["decision_annee"] = None else: decisions["decision_annee"] = None return decisions diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index 4cba4c69d..25b246b5f 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -795,7 +795,9 @@ def etud_descr_situation_semestre( descr_mention = "" # Décisions APC / BUT - if pv.get("decision_annee", {}): + if pv.get("decision_annee", {}) and sco_preferences.get_preference( + "bul_but_code_annuel", formsemestre.id + ): infos["descr_decision_annee"] = "Décision année: " + pv.get( "decision_annee", {} ).get("code", "") diff --git a/app/scodoc/sco_formations.py b/app/scodoc/sco_formations.py index b00908193..afb640cdf 100644 --- a/app/scodoc/sco_formations.py +++ b/app/scodoc/sco_formations.py @@ -143,8 +143,8 @@ def formation_export_dict( if not export_codes_apo: ue_dict.pop("code_apogee", None) - if ue_dict["ects"] is None: - del ue_dict["ects"] + if ue_dict.get("ects") is None: + ue_dict.pop("ects", None) mats = sco_edit_matiere.matiere_list({"ue_id": ue.id}) mats.sort(key=lambda m: m["numero"] or 0) ue_dict["matiere"] = mats diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index b199aa924..273536474 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -1592,7 +1592,9 @@ def formsemestre_edit_options(formsemestre_id): ok, err = sco_permissions_check.check_access_diretud(formsemestre_id) if not ok: return err - return sco_preferences.SemPreferences(formsemestre_id).edit(categories=["bul"]) + return sco_preferences.SemPreferences(formsemestre_id).edit( + categories=["bul", "bul_but_pdf"] + ) def formsemestre_change_publication_bul( diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py index 0072142df..8176092e1 100644 --- a/app/scodoc/sco_preferences.py +++ b/app/scodoc/sco_preferences.py @@ -233,7 +233,7 @@ PREF_CATEGORIES = ( ( "bul_but_pdf", { - "title": "Réglages des bulletins BUT (pdf)", + "title": "Réglages des bulletins BUT", "related": ( "bul", "bul_margins", @@ -1742,6 +1742,17 @@ class BasePreferences: "category": "bul_but_pdf", }, ), + ( + "bul_but_code_annuel", + { + "initvalue": 1, + "title": "Bulletins BUT: afficher la décision annuelle", + "explanation": "car en cours d'année elle n'a parfois pas de sens", + "input_type": "boolcheckbox", + "labels": ["non", "oui"], + "category": "bul_but_pdf", + }, + ), # XXX A COMPLETER, voir sco_formsemestre_edit.py XXX # bul_mail ( @@ -2245,7 +2256,7 @@ class BasePreferences: self.load() H = [ html_sco_header.sco_header( - page_title="Préférences", + page_title=f"Préférences {g.scodoc_dept}", javascripts=["js/detail_summary_persistence.js"], ), f"

Préférences globales pour le département {g.scodoc_dept}

",