1
0
forked from ScoDoc/ScoDoc

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.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

View File

@ -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", "")

View File

@ -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

View File

@ -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(

View File

@ -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"<h2>Préférences globales pour le département {g.scodoc_dept}</h2>",