forked from ScoDoc/ScoDoc
Changement réf. comp. équivalent: SD <> STID.
This commit is contained in:
parent
dcdf6a8012
commit
02a5b00ecf
@ -274,6 +274,11 @@ class ApcReferentielCompetences(db.Model, XMLModel):
|
||||
return "type_departement mismatch"
|
||||
# Table d'équivalences entre refs:
|
||||
equiv = self._load_config_equivalences()
|
||||
# Même specialité (ou alias) ?
|
||||
if self.specialite != other.specialite and other.specialite not in equiv.get(
|
||||
"alias", []
|
||||
):
|
||||
return "specialite mismatch"
|
||||
# mêmes parcours ?
|
||||
eq_parcours = equiv.get("parcours", {})
|
||||
parcours_by_code_1 = {eq_parcours.get(p.code, p.code): p for p in self.parcours}
|
||||
@ -317,6 +322,9 @@ class ApcReferentielCompetences(db.Model, XMLModel):
|
||||
def _load_config_equivalences(self) -> dict:
|
||||
"""Load config file ressources/referentiels/equivalences.yaml
|
||||
used to define equivalences between distinct referentiels
|
||||
return a dict, with optional keys:
|
||||
alias: list of equivalent names for speciality (eg SD == STID)
|
||||
parcours: dict with equivalent parcours acronyms
|
||||
"""
|
||||
try:
|
||||
with open(REFCOMP_EQUIVALENCE_FILENAME, encoding="utf-8") as f:
|
||||
|
@ -56,7 +56,9 @@ def refcomp(refcomp_id):
|
||||
@permission_required(Permission.ScoView)
|
||||
def refcomp_show(refcomp_id):
|
||||
"""Affichage du référentiel de compétences."""
|
||||
referentiel_competence = ApcReferentielCompetences.query.get_or_404(refcomp_id)
|
||||
referentiel_competence: ApcReferentielCompetences = (
|
||||
ApcReferentielCompetences.query.get_or_404(refcomp_id)
|
||||
)
|
||||
# Autres référentiels "équivalents" pour proposer de changer les formations:
|
||||
referentiels_equivalents = referentiel_competence.equivalents()
|
||||
return render_template(
|
||||
|
@ -15,4 +15,10 @@ QLIO: # la clé est 'specialite'
|
||||
ATN: MTD
|
||||
# competences: # titres de compétences ('nom_court' dans le XML)
|
||||
|
||||
SD: STID
|
||||
STID: # passage de STID à SD
|
||||
alias:
|
||||
- SD
|
||||
|
||||
SD: # pour revenir en arrière au besoin
|
||||
alias:
|
||||
- STID
|
||||
|
Loading…
Reference in New Issue
Block a user