Ajout balises BUT pour bulletins PDF. Voir # 587

This commit is contained in:
Emmanuel Viennet 2023-03-08 22:56:11 +01:00 committed by iziram
parent d5dfa37b91
commit 60711d674b
7 changed files with 36 additions and 13 deletions

View File

@ -501,7 +501,7 @@ class BulletinBUT:
# --- Decision Jury
infos, dpv = sco_bulletins.etud_descr_situation_semestre(
etud.id,
self.res.formsemestre.id,
self.res.formsemestre,
format="html",
show_date_inscr=self.prefs["bul_show_date_inscr"],
show_decisions=self.prefs["bul_show_decision"],

View File

@ -253,7 +253,7 @@ def bulletin_but_xml_compat(
):
infos, dpv = sco_bulletins.etud_descr_situation_semestre(
etudid,
formsemestre_id,
formsemestre,
format="xml",
show_uevalid=sco_preferences.get_preference(
"bul_show_uevalid", formsemestre_id

View File

@ -42,8 +42,15 @@ from app import log
from app.scodoc.sco_utils import json_error
from app.but import bulletin_but
from app.comp import res_sem
from app.comp.res_but import ResultatsSemestreBUT
from app.comp.res_compat import NotesTableCompat
from app.models import Formation, FormSemestre, Identite, ModuleImplInscription
from app.models import (
ApcParcours,
Formation,
FormSemestre,
Identite,
ModuleImplInscription,
)
from app.scodoc.sco_permissions import Permission
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
from app.scodoc import html_sco_header
@ -194,7 +201,7 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"):
# --- Decision Jury
infos, dpv = etud_descr_situation_semestre(
etudid,
formsemestre_id,
formsemestre,
format="html",
show_date_inscr=prefs["bul_show_date_inscr"],
show_decisions=prefs["bul_show_decision"],
@ -686,7 +693,7 @@ def get_etud_rangs_groups(
def etud_descr_situation_semestre(
etudid,
formsemestre_id,
formsemestre: FormSemestre,
ne="",
format="html", # currently unused
show_decisions=True,
@ -711,14 +718,13 @@ def etud_descr_situation_semestre(
decisions_ue : noms (acronymes) des UE validées, séparées par des virgules.
descr_decisions_ue : ' UE acquises: UE1, UE2', ou vide si pas de dec. ou si pas show_uevalid
descr_mention : 'Mention Bien', ou vide si pas de mention ou si pas show_mention
descr_parcours : le nom (libelle) du parcours dans lequel est inscrit l'étudiant en BUT (vide ailleurs)
parcours_titre, parcours_code, refcomp_specialite, refcomp_specialite_long
"""
# Fonction utilisée par tous les bulletins (APC ou classiques)
infos = collections.defaultdict(str)
# --- Situation et décisions jury
date_inscr, date_dem, date_def = _dates_insc_dem_def(etudid, formsemestre_id)
date_inscr, date_dem, date_def = _dates_insc_dem_def(etudid, formsemestre.id)
if show_date_inscr:
if not date_inscr:
@ -733,6 +739,22 @@ def etud_descr_situation_semestre(
infos["descr_defaillance"] = ""
# Parcours BUT
infos["parcours_titre"] = ""
infos["parcours_code"] = ""
infos["refcomp_specialite"] = ""
infos["refcomp_specialite_long"] = ""
if formsemestre.formation.is_apc():
res: ResultatsSemestreBUT = res_sem.load_formsemestre_results(formsemestre)
parcour: ApcParcours = ApcParcours.query.get(res.etuds_parcour_id[etudid])
if parcour:
infos["parcours_titre"] = parcour.libelle or ""
infos["parcours_code"] = parcour.code or ""
refcomp = parcour.referentiel
if refcomp:
infos["refcomp_specialite"] = refcomp.specialite
infos["refcomp_specialite_long"] = refcomp.specialite_long
# Décision: valeurs par defaut vides:
infos["decision_jury"] = infos["descr_decision_jury"] = ""
infos["decision_sem"] = ""
@ -753,7 +775,7 @@ def etud_descr_situation_semestre(
infos["date_defaillance"] = date_def
infos["descr_decision_jury"] = f"Défaillant{ne}"
dpv = sco_dict_pv_jury.dict_pvjury(formsemestre_id, etudids=[etudid])
dpv = sco_pv_dict.dict_pvjury(formsemestre.id, etudids=[etudid])
if dpv:
infos["decision_sem"] = dpv["decisions"][0]["decision_sem"]

View File

@ -462,7 +462,7 @@ def dict_decision_jury(
if prefs["bul_show_decision"] or with_decisions:
infos, dpv = sco_bulletins.etud_descr_situation_semestre(
etud.id,
formsemestre.id,
formsemestre,
show_uevalid=prefs["bul_show_uevalid"],
)
d["situation"] = infos["situation"]

View File

@ -378,7 +378,7 @@ def make_xml_formsemestre_bulletinetud(
):
infos, dpv = sco_bulletins.etud_descr_situation_semestre(
etudid,
formsemestre_id,
formsemestre,
format="xml",
show_uevalid=sco_preferences.get_preference(
"bul_show_uevalid", formsemestre_id

View File

@ -43,7 +43,7 @@ from app.models.validations import ScolarEvent
import app.scodoc.sco_utils as scu
from app import log
from app.scodoc.scolog import logdb
from app.scodoc.sco_exceptions import ScoException, ScoValueError
from app.scodoc.sco_exceptions import ScoValueError
from app.scodoc.codes_cursus import UE_STANDARD, UE_SPORT, UE_TYPE_NAME
import app.scodoc.notesdb as ndb
from app.scodoc.TrivialFormulator import TrivialFormulator

View File

@ -239,9 +239,10 @@ def ficheEtud(etudid=None):
sem_info = {}
for sem in info["sems"]:
if sem["ins"]["etat"] != scu.INSCRIT:
formsemestre: FormSemestre = FormSemestre.query.get(sem["formsemestre_id"])
descr, _ = etud_descr_situation_semestre(
etudid,
sem["formsemestre_id"],
formsemestre,
info["ne"],
show_date_inscr=False,
)