Modification priorité codes jury: PASD > PAS1NCI

This commit is contained in:
Emmanuel Viennet 2023-06-22 08:22:37 +02:00 committed by iziram
parent b44563666a
commit b696f772bf
6 changed files with 20 additions and 20 deletions

View File

@ -129,8 +129,8 @@ class EtudCursusBUT:
).get(validation_rcue.annee()) ).get(validation_rcue.annee())
# prend la "meilleure" validation # prend la "meilleure" validation
if (not previous_validation) or ( if (not previous_validation) or (
sco_codes.BUT_CODES_ORDERED[validation_rcue.code] sco_codes.BUT_CODES_ORDER[validation_rcue.code]
> sco_codes.BUT_CODES_ORDERED[previous_validation.code] > sco_codes.BUT_CODES_ORDER[previous_validation.code]
): ):
self.validation_par_competence_et_annee[niveau.competence.id][ self.validation_par_competence_et_annee[niveau.competence.id][
niveau.annee niveau.annee
@ -200,7 +200,7 @@ class EtudCursusBUT:
validations_by_niveau[validation_rcue.niveau().id].append(validation_rcue) validations_by_niveau[validation_rcue.niveau().id].append(validation_rcue)
validation_by_niveau = { validation_by_niveau = {
niveau_id: sorted( niveau_id: sorted(
validations, key=lambda v: sco_codes.BUT_CODES_ORDERED[v.code] validations, key=lambda v: sco_codes.BUT_CODES_ORDER[v.code]
)[0] )[0]
for niveau_id, validations in validations_by_niveau.items() for niveau_id, validations in validations_by_niveau.items()
if validations if validations
@ -304,8 +304,8 @@ class FormSemestreCursusBUT:
).get(validation_rcue.annee()) ).get(validation_rcue.annee())
# prend la "meilleure" validation # prend la "meilleure" validation
if (not previous_validation) or ( if (not previous_validation) or (
sco_codes.BUT_CODES_ORDERED[validation_rcue.code] sco_codes.BUT_CODES_ORDER[validation_rcue.code]
> sco_codes.BUT_CODES_ORDERED[previous_validation["code"]] > sco_codes.BUT_CODES_ORDER[previous_validation["code"]]
): ):
self.validation_par_competence_et_annee[niveau.competence.id][ self.validation_par_competence_et_annee[niveau.competence.id][
niveau.annee niveau.annee
@ -341,8 +341,8 @@ class FormSemestreCursusBUT:
).get(validation_rcue.annee()) ).get(validation_rcue.annee())
# prend la "meilleure" validation # prend la "meilleure" validation
if (not previous_validation) or ( if (not previous_validation) or (
sco_codes.BUT_CODES_ORDERED[validation_rcue.code] sco_codes.BUT_CODES_ORDER[validation_rcue.code]
> sco_codes.BUT_CODES_ORDERED[previous_validation["code"]] > sco_codes.BUT_CODES_ORDER[previous_validation["code"]]
): ):
self.validation_par_competence_et_annee[niveau.competence.id][ self.validation_par_competence_et_annee[niveau.competence.id][
niveau.annee niveau.annee

View File

@ -94,7 +94,7 @@ from app.scodoc import sco_cache
from app.scodoc import codes_cursus as sco_codes from app.scodoc import codes_cursus as sco_codes
from app.scodoc.codes_cursus import ( from app.scodoc.codes_cursus import (
code_rcue_validant, code_rcue_validant,
BUT_CODES_ORDERED, BUT_CODES_ORDER,
CODES_RCUE_VALIDES, CODES_RCUE_VALIDES,
CODES_UE_CAPITALISANTS, CODES_UE_CAPITALISANTS,
CODES_UE_VALIDES, CODES_UE_VALIDES,
@ -878,8 +878,8 @@ class DecisionsProposeesAnnee(DecisionsProposees):
(not dec_rcue.recorded) (not dec_rcue.recorded)
and ( # enregistre seulement si pas déjà validé "mieux" and ( # enregistre seulement si pas déjà validé "mieux"
(not dec_rcue.validation) (not dec_rcue.validation)
or BUT_CODES_ORDERED.get(dec_rcue.validation.code, 0) or BUT_CODES_ORDER.get(dec_rcue.validation.code, 0)
< BUT_CODES_ORDERED.get(code, 0) < BUT_CODES_ORDER.get(code, 0)
) )
and ( # décision validante de droit ? and ( # décision validante de droit ?
( (
@ -1121,9 +1121,9 @@ class DecisionsProposeesRCUE(DecisionsProposees):
code_default = self.codes[0] code_default = self.codes[0]
if self.code_valide in self.codes: if self.code_valide in self.codes:
self.codes.remove(self.code_valide) self.codes.remove(self.code_valide)
if sco_codes.BUT_CODES_ORDERED.get( if sco_codes.BUT_CODES_ORDER.get(
self.code_valide, 0 self.code_valide, 0
) > sco_codes.BUT_CODES_ORDERED.get(code_default, 0): ) > sco_codes.BUT_CODES_ORDER.get(code_default, 0):
self.codes.insert(0, self.code_valide) self.codes.insert(0, self.code_valide)
else: else:
self.codes.insert(1, self.code_valide) self.codes.insert(1, self.code_valide)

View File

@ -253,8 +253,8 @@ def _gen_but_rcue(dec_rcue: DecisionsProposeesRCUE, niveau: ApcNiveau) -> str:
descr_validation = f"""Décision recommandée: <b>{dec_rcue.codes[0]}.</b> descr_validation = f"""Décision recommandée: <b>{dec_rcue.codes[0]}.</b>
Il y avait {dec_rcue.validation.html()}""" Il y avait {dec_rcue.validation.html()}"""
if ( if (
sco_codes.BUT_CODES_ORDERED[dec_rcue.codes[0]] sco_codes.BUT_CODES_ORDER[dec_rcue.codes[0]]
> sco_codes.BUT_CODES_ORDERED[dec_rcue.code_valide] > sco_codes.BUT_CODES_ORDER[dec_rcue.code_valide]
): ):
code_propose_menu = dec_rcue.codes[0] code_propose_menu = dec_rcue.codes[0]
scoplement = f"""<div class="scoplement">{descr_validation}</div>""" scoplement = f"""<div class="scoplement">{descr_validation}</div>"""

View File

@ -20,7 +20,7 @@ from app.models.but_refcomp import ApcParcours, ApcNiveau
from app.models.ues import DispenseUE, UniteEns from app.models.ues import DispenseUE, UniteEns
from app.models.but_validations import ApcValidationAnnee, ApcValidationRCUE from app.models.but_validations import ApcValidationAnnee, ApcValidationRCUE
from app.scodoc import sco_preferences from app.scodoc import sco_preferences
from app.scodoc.codes_cursus import BUT_CODES_ORDERED, UE_SPORT from app.scodoc.codes_cursus import BUT_CODES_ORDER, UE_SPORT
from app.scodoc.sco_utils import ModuleType from app.scodoc.sco_utils import ModuleType
@ -353,7 +353,7 @@ class ResultatsSemestreBUT(NotesTableCompat):
for validation in validations: for validation in validations:
if validation.etudid in validation_by_etud: if validation.etudid in validation_by_etud:
# keep the "best" # keep the "best"
if BUT_CODES_ORDERED.get(validation.code, 0) > BUT_CODES_ORDERED.get( if BUT_CODES_ORDER.get(validation.code, 0) > BUT_CODES_ORDER.get(
validation_by_etud[validation.etudid].code, 0 validation_by_etud[validation.etudid].code, 0
): ):
validation_by_etud[validation.etudid] = validation validation_by_etud[validation.etudid] = validation

View File

@ -222,15 +222,15 @@ BUT_CODES_PASSAGE = {
} }
# les codes, du plus "défavorable" à l'étudiant au plus favorable: # les codes, du plus "défavorable" à l'étudiant au plus favorable:
# (valeur par défaut 0) # (valeur par défaut 0)
BUT_CODES_ORDERED = { BUT_CODES_ORDER = {
NAR: 0, NAR: 0,
DEF: 0, DEF: 0,
AJ: 10, AJ: 10,
ATJ: 20, ATJ: 20,
CMP: 50, CMP: 50,
ADC: 50, ADC: 50,
PASD: 50, PAS1NCI: 50,
PAS1NCI: 60, PASD: 60,
ADJR: 90, ADJR: 90,
ADSUP: 90, ADSUP: 90,
ADJ: 100, ADJ: 100,

View File

@ -581,7 +581,7 @@ def _list_but_ue_inscriptions(res: NotesTableCompat, read_only: bool = True) ->
.all() .all()
) )
validations_ue.sort( validations_ue.sort(
key=lambda v: codes_cursus.BUT_CODES_ORDERED.get(v.code, 0) key=lambda v: codes_cursus.BUT_CODES_ORDER.get(v.code, 0)
) )
validation = validations_ue[-1] if validations_ue else None validation = validations_ue[-1] if validations_ue else None
expl_validation = ( expl_validation = (