diff --git a/app/models/but_validations.py b/app/models/but_validations.py index 9a6953b9..fb3ade82 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 4cba4c69..25b246b5 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 b0090819..afb640cd 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 b199aa92..27353647 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 0072142d..8176092e 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"