forked from ScoDoc/ScoDoc
Diplome BUT: PV et lettre indiv. #929
This commit is contained in:
parent
6224f37e4a
commit
070c9ea36f
@ -29,7 +29,7 @@ from app.models.but_refcomp import (
|
||||
ApcReferentielCompetences,
|
||||
)
|
||||
from app.models.ues import UEParcours
|
||||
from app.models.but_validations import ApcValidationRCUE
|
||||
from app.models.but_validations import ApcValidationAnnee, ApcValidationRCUE
|
||||
from app.models.etudiants import Identite
|
||||
from app.models.formations import Formation
|
||||
from app.models.formsemestre import FormSemestre
|
||||
@ -42,7 +42,7 @@ from app.scodoc import sco_cursus_dut
|
||||
|
||||
|
||||
class SituationEtudCursusBUT(sco_cursus_dut.SituationEtudCursusClassic):
|
||||
"""Pour compat ScoDoc 7: à revoir pour le BUT"""
|
||||
"""Pour compat ScoDoc 7"""
|
||||
|
||||
def __init__(self, etud: Identite, formsemestre_id: int, res: ResultatsSemestreBUT):
|
||||
super().__init__(etud, formsemestre_id, res)
|
||||
@ -54,8 +54,16 @@ class SituationEtudCursusBUT(sco_cursus_dut.SituationEtudCursusClassic):
|
||||
return False
|
||||
|
||||
def parcours_validated(self):
|
||||
"True si le parcours est validé"
|
||||
return False # XXX TODO
|
||||
"True si le parcours (ici diplôme BUT) est validé"
|
||||
# Si année 3 validée, ok
|
||||
return any(
|
||||
sco_codes.code_annee_validant(v.code)
|
||||
for v in ApcValidationAnnee.query.filter_by(
|
||||
etudid=self.etud.id,
|
||||
ordre=3,
|
||||
referentiel_competence_id=self.cur_sem.formation.referentiel_competence_id,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class EtudCursusBUT:
|
||||
@ -287,81 +295,81 @@ class FormSemestreCursusBUT:
|
||||
)
|
||||
return niveaux_by_annee
|
||||
|
||||
def get_etud_validation_par_competence_et_annee(self, etud: Identite):
|
||||
"""{ competence_id : { 'BUT1' : validation_rcue (la "meilleure"), ... } }"""
|
||||
validation_par_competence_et_annee = {}
|
||||
for validation_rcue in ApcValidationRCUE.query.filter_by(etud=etud):
|
||||
# On s'assurer qu'elle concerne notre cursus !
|
||||
ue = validation_rcue.ue2
|
||||
if ue.id not in self.ue_ids:
|
||||
if (
|
||||
ue.formation.referentiel_competences_id
|
||||
== self.referentiel_competences_id
|
||||
):
|
||||
self.ue_ids = ue.id
|
||||
else:
|
||||
continue # skip this validation
|
||||
niveau = validation_rcue.niveau()
|
||||
if not niveau.competence.id in validation_par_competence_et_annee:
|
||||
validation_par_competence_et_annee[niveau.competence.id] = {}
|
||||
previous_validation = validation_par_competence_et_annee.get(
|
||||
niveau.competence.id
|
||||
).get(validation_rcue.annee())
|
||||
# prend la "meilleure" validation
|
||||
if (not previous_validation) or (
|
||||
sco_codes.BUT_CODES_ORDER[validation_rcue.code]
|
||||
> sco_codes.BUT_CODES_ORDER[previous_validation["code"]]
|
||||
):
|
||||
self.validation_par_competence_et_annee[niveau.competence.id][
|
||||
niveau.annee
|
||||
] = validation_rcue
|
||||
return validation_par_competence_et_annee
|
||||
# def get_etud_validation_par_competence_et_annee(self, etud: Identite):
|
||||
# """{ competence_id : { 'BUT1' : validation_rcue (la "meilleure"), ... } }"""
|
||||
# validation_par_competence_et_annee = {}
|
||||
# for validation_rcue in ApcValidationRCUE.query.filter_by(etud=etud):
|
||||
# # On s'assurer qu'elle concerne notre cursus !
|
||||
# ue = validation_rcue.ue2
|
||||
# if ue.id not in self.ue_ids:
|
||||
# if (
|
||||
# ue.formation.referentiel_competences_id
|
||||
# == self.referentiel_competences_id
|
||||
# ):
|
||||
# self.ue_ids = ue.id
|
||||
# else:
|
||||
# continue # skip this validation
|
||||
# niveau = validation_rcue.niveau()
|
||||
# if not niveau.competence.id in validation_par_competence_et_annee:
|
||||
# validation_par_competence_et_annee[niveau.competence.id] = {}
|
||||
# previous_validation = validation_par_competence_et_annee.get(
|
||||
# niveau.competence.id
|
||||
# ).get(validation_rcue.annee())
|
||||
# # prend la "meilleure" validation
|
||||
# if (not previous_validation) or (
|
||||
# sco_codes.BUT_CODES_ORDER[validation_rcue.code]
|
||||
# > sco_codes.BUT_CODES_ORDER[previous_validation["code"]]
|
||||
# ):
|
||||
# self.validation_par_competence_et_annee[niveau.competence.id][
|
||||
# niveau.annee
|
||||
# ] = validation_rcue
|
||||
# return validation_par_competence_et_annee
|
||||
|
||||
def list_etud_inscriptions(self, etud: Identite):
|
||||
"Le parcours à valider: celui du DERNIER semestre suivi (peut être None)"
|
||||
self.niveaux_by_annee = {}
|
||||
"{ annee : liste des niveaux à valider }"
|
||||
self.niveaux: dict[int, ApcNiveau] = {}
|
||||
"cache les niveaux"
|
||||
for annee in (1, 2, 3):
|
||||
niveaux_d = formation.referentiel_competence.get_niveaux_by_parcours(
|
||||
annee, [self.parcour] if self.parcour else None # XXX WIP
|
||||
)[1]
|
||||
# groupe les niveaux de tronc commun et ceux spécifiques au parcour
|
||||
self.niveaux_by_annee[annee] = niveaux_d["TC"] + (
|
||||
niveaux_d[self.parcour.id] if self.parcour else []
|
||||
)
|
||||
self.niveaux.update(
|
||||
{niveau.id: niveau for niveau in self.niveaux_by_annee[annee]}
|
||||
)
|
||||
# def list_etud_inscriptions(self, etud: Identite):
|
||||
# "Le parcours à valider: celui du DERNIER semestre suivi (peut être None)"
|
||||
# self.niveaux_by_annee = {}
|
||||
# "{ annee : liste des niveaux à valider }"
|
||||
# self.niveaux: dict[int, ApcNiveau] = {}
|
||||
# "cache les niveaux"
|
||||
# for annee in (1, 2, 3):
|
||||
# niveaux_d = formation.referentiel_competence.get_niveaux_by_parcours(
|
||||
# annee, [self.parcour] if self.parcour else None # XXX WIP
|
||||
# )[1]
|
||||
# # groupe les niveaux de tronc commun et ceux spécifiques au parcour
|
||||
# self.niveaux_by_annee[annee] = niveaux_d["TC"] + (
|
||||
# niveaux_d[self.parcour.id] if self.parcour else []
|
||||
# )
|
||||
# self.niveaux.update(
|
||||
# {niveau.id: niveau for niveau in self.niveaux_by_annee[annee]}
|
||||
# )
|
||||
|
||||
self.validation_par_competence_et_annee = {}
|
||||
"""{ competence_id : { 'BUT1' : validation_rcue (la "meilleure"), ... } }"""
|
||||
for validation_rcue in ApcValidationRCUE.query.filter_by(etud=etud):
|
||||
niveau = validation_rcue.niveau()
|
||||
if not niveau.competence.id in self.validation_par_competence_et_annee:
|
||||
self.validation_par_competence_et_annee[niveau.competence.id] = {}
|
||||
previous_validation = self.validation_par_competence_et_annee.get(
|
||||
niveau.competence.id
|
||||
).get(validation_rcue.annee())
|
||||
# prend la "meilleure" validation
|
||||
if (not previous_validation) or (
|
||||
sco_codes.BUT_CODES_ORDER[validation_rcue.code]
|
||||
> sco_codes.BUT_CODES_ORDER[previous_validation["code"]]
|
||||
):
|
||||
self.validation_par_competence_et_annee[niveau.competence.id][
|
||||
niveau.annee
|
||||
] = validation_rcue
|
||||
# self.validation_par_competence_et_annee = {}
|
||||
# """{ competence_id : { 'BUT1' : validation_rcue (la "meilleure"), ... } }"""
|
||||
# for validation_rcue in ApcValidationRCUE.query.filter_by(etud=etud):
|
||||
# niveau = validation_rcue.niveau()
|
||||
# if not niveau.competence.id in self.validation_par_competence_et_annee:
|
||||
# self.validation_par_competence_et_annee[niveau.competence.id] = {}
|
||||
# previous_validation = self.validation_par_competence_et_annee.get(
|
||||
# niveau.competence.id
|
||||
# ).get(validation_rcue.annee())
|
||||
# # prend la "meilleure" validation
|
||||
# if (not previous_validation) or (
|
||||
# sco_codes.BUT_CODES_ORDER[validation_rcue.code]
|
||||
# > sco_codes.BUT_CODES_ORDER[previous_validation["code"]]
|
||||
# ):
|
||||
# self.validation_par_competence_et_annee[niveau.competence.id][
|
||||
# niveau.annee
|
||||
# ] = validation_rcue
|
||||
|
||||
self.competences = {
|
||||
competence.id: competence
|
||||
for competence in (
|
||||
self.parcour.query_competences()
|
||||
if self.parcour
|
||||
else self.formation.referentiel_competence.get_competences_tronc_commun()
|
||||
)
|
||||
}
|
||||
"cache { competence_id : competence }"
|
||||
# self.competences = {
|
||||
# competence.id: competence
|
||||
# for competence in (
|
||||
# self.parcour.query_competences()
|
||||
# if self.parcour
|
||||
# else self.formation.referentiel_competence.get_competences_tronc_commun()
|
||||
# )
|
||||
# }
|
||||
# "cache { competence_id : competence }"
|
||||
|
||||
|
||||
def but_ects_valides(etud: Identite, referentiel_competence_id: int) -> float:
|
||||
|
@ -1034,8 +1034,8 @@ class DecisionsProposeesAnnee(DecisionsProposees):
|
||||
return messages
|
||||
|
||||
def valide_diplome(self) -> bool:
|
||||
"Vrai si l'étudiant à validé son diplôme"
|
||||
return False # TODO XXX
|
||||
"Vrai si l'étudiant a validé son diplôme (décision enregistrée)"
|
||||
return self.annee_but == 3 and sco_codes.code_annee_validant(self.code_valide)
|
||||
|
||||
|
||||
def list_ue_parcour_etud(
|
||||
|
@ -155,6 +155,7 @@ def pvjury_table_but(
|
||||
deca = None
|
||||
|
||||
ects_but_valides = but_ects_valides(etud, referentiel_competence_id)
|
||||
has_diplome = deca.valide_diplome()
|
||||
row = {
|
||||
"nom_pv": (
|
||||
etud.code_ine or etud.code_nip or etud.id
|
||||
@ -181,10 +182,15 @@ def pvjury_table_but(
|
||||
),
|
||||
"decision_but": deca.code_valide if deca else "",
|
||||
"devenir": (
|
||||
"Diplôme obtenu"
|
||||
if has_diplome
|
||||
else (
|
||||
", ".join([f"S{i}" for i in deca.get_autorisations_passage()])
|
||||
if deca
|
||||
else ""
|
||||
)
|
||||
),
|
||||
"diplome": "ADM" if has_diplome else "",
|
||||
# pour exports excel seulement:
|
||||
"civilite": etud.civilite_etat_civil_str,
|
||||
"nom": etud.nom,
|
||||
|
@ -219,6 +219,7 @@ def dict_decision_jury(etud: Identite, formsemestre: FormSemestre) -> dict:
|
||||
dec_rcue["code"]}"""
|
||||
)
|
||||
decisions["descr_decisions_rcue"] = ", ".join(titres_rcues)
|
||||
decisions["descr_decisions_rcue_list"] = titres_rcues
|
||||
decisions["descr_decisions_niveaux"] = (
|
||||
"Niveaux de compétences: " + decisions["descr_decisions_rcue"]
|
||||
)
|
||||
|
@ -257,7 +257,9 @@ def pdf_lettre_individuelle(sem, decision, etud: Identite, params, signature=Non
|
||||
else:
|
||||
params["autorisations_txt"] = ""
|
||||
|
||||
if decision["decision_sem"] and situation_etud.parcours_validated():
|
||||
if (
|
||||
formsemestre.formation.is_apc() or decision["decision_sem"]
|
||||
) and situation_etud.parcours_validated():
|
||||
params["diplome_txt"] = (
|
||||
"""Vous avez donc obtenu le diplôme : <b>%(titre_formation)s</b>""" % params
|
||||
)
|
||||
@ -357,5 +359,8 @@ def add_apc_infos(formsemestre: FormSemestre, params: dict, decision: dict):
|
||||
params[
|
||||
"decision_ue_txt"
|
||||
] = f"""{params["decision_ue_txt"]}<br/>
|
||||
<b>Niveaux de compétences:</b><br/> {decision.get("descr_decisions_rcue") or ""}
|
||||
<b>Niveaux de compétences:</b>
|
||||
<br/> - {
|
||||
'<br/> - '.join( decision.get("descr_decisions_rcue_list", []) )
|
||||
}
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user