BUT: Option pour ne pas afficher décision annuelle sur bulletins

This commit is contained in:
Emmanuel Viennet 2024-01-26 16:14:08 +01:00
parent 79f07deac0
commit d1074a8227
5 changed files with 34 additions and 15 deletions

View File

@ -9,6 +9,7 @@ from app.models.but_refcomp import ApcNiveau
from app.models.etudiants import Identite from app.models.etudiants import Identite
from app.models.formsemestre import FormSemestre from app.models.formsemestre import FormSemestre
from app.models.ues import UniteEns from app.models.ues import UniteEns
from app.scodoc import sco_preferences
class ApcValidationRCUE(db.Model): class ApcValidationRCUE(db.Model):
@ -218,6 +219,7 @@ def dict_decision_jury(etud: Identite, formsemestre: FormSemestre) -> dict:
decisions["descr_decisions_rcue"] = "" decisions["descr_decisions_rcue"] = ""
decisions["descr_decisions_niveaux"] = "" decisions["descr_decisions_niveaux"] = ""
# --- Année: prend la validation pour l'année scolaire et l'ordre de ce semestre # --- Année: prend la validation pour l'année scolaire et l'ordre de ce semestre
if sco_preferences.get_preference("bul_but_code_annuel", formsemestre.id):
annee_but = (formsemestre.semestre_id + 1) // 2 annee_but = (formsemestre.semestre_id + 1) // 2
validation = ApcValidationAnnee.query.filter_by( validation = ApcValidationAnnee.query.filter_by(
etudid=etud.id, etudid=etud.id,
@ -229,4 +231,6 @@ def dict_decision_jury(etud: Identite, formsemestre: FormSemestre) -> dict:
decisions["decision_annee"] = validation.to_dict_bul() decisions["decision_annee"] = validation.to_dict_bul()
else: else:
decisions["decision_annee"] = None decisions["decision_annee"] = None
else:
decisions["decision_annee"] = None
return decisions return decisions

View File

@ -795,7 +795,9 @@ def etud_descr_situation_semestre(
descr_mention = "" descr_mention = ""
# Décisions APC / BUT # 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( infos["descr_decision_annee"] = "Décision année: " + pv.get(
"decision_annee", {} "decision_annee", {}
).get("code", "") ).get("code", "")

View File

@ -143,8 +143,8 @@ def formation_export_dict(
if not export_codes_apo: if not export_codes_apo:
ue_dict.pop("code_apogee", None) ue_dict.pop("code_apogee", None)
if ue_dict["ects"] is None: if ue_dict.get("ects") is None:
del ue_dict["ects"] ue_dict.pop("ects", None)
mats = sco_edit_matiere.matiere_list({"ue_id": ue.id}) mats = sco_edit_matiere.matiere_list({"ue_id": ue.id})
mats.sort(key=lambda m: m["numero"] or 0) mats.sort(key=lambda m: m["numero"] or 0)
ue_dict["matiere"] = mats ue_dict["matiere"] = mats

View File

@ -1592,7 +1592,9 @@ def formsemestre_edit_options(formsemestre_id):
ok, err = sco_permissions_check.check_access_diretud(formsemestre_id) ok, err = sco_permissions_check.check_access_diretud(formsemestre_id)
if not ok: if not ok:
return err 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( def formsemestre_change_publication_bul(

View File

@ -233,7 +233,7 @@ PREF_CATEGORIES = (
( (
"bul_but_pdf", "bul_but_pdf",
{ {
"title": "Réglages des bulletins BUT (pdf)", "title": "Réglages des bulletins BUT",
"related": ( "related": (
"bul", "bul",
"bul_margins", "bul_margins",
@ -1742,6 +1742,17 @@ class BasePreferences:
"category": "bul_but_pdf", "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 # XXX A COMPLETER, voir sco_formsemestre_edit.py XXX
# bul_mail # bul_mail
( (
@ -2245,7 +2256,7 @@ class BasePreferences:
self.load() self.load()
H = [ H = [
html_sco_header.sco_header( 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"], javascripts=["js/detail_summary_persistence.js"],
), ),
f"<h2>Préférences globales pour le département {g.scodoc_dept}</h2>", f"<h2>Préférences globales pour le département {g.scodoc_dept}</h2>",