forked from ScoDoc/ScoDoc
Minor code tweak: ue sort keys
This commit is contained in:
parent
faf09af63c
commit
bc3427702e
@ -1108,7 +1108,7 @@ def list_ue_parcour_etud(
|
||||
ues = (
|
||||
formsemestre.formation.query_ues_parcour(parcour)
|
||||
.filter(UniteEns.semestre_idx == formsemestre.semestre_id)
|
||||
.order_by(UniteEns.numero)
|
||||
.order_by(UniteEns.numero, UniteEns.acronyme)
|
||||
.all()
|
||||
)
|
||||
return [ue for ue in ues if (etud.id, ue.id) not in res.dispense_ues]
|
||||
|
@ -95,7 +95,7 @@ class ValidationsSemestre(ResultatsCache):
|
||||
for decision in (
|
||||
decisions_jury_q.filter(db.text("ue_id is not NULL"))
|
||||
.join(UniteEns)
|
||||
.order_by(UniteEns.numero)
|
||||
.order_by(UniteEns.numero, UniteEns.acronyme)
|
||||
):
|
||||
if decision.etudid not in decisions_jury_ues:
|
||||
decisions_jury_ues[decision.etudid] = {}
|
||||
|
@ -471,7 +471,7 @@ class FormSemestre(models.ScoDocModel):
|
||||
)
|
||||
if not with_sport:
|
||||
sem_ues = sem_ues.filter(UniteEns.type != codes_cursus.UE_SPORT)
|
||||
ues = sem_ues.order_by(UniteEns.numero).all()
|
||||
ues = sem_ues.order_by(UniteEns.numero, UniteEns.acronyme).all()
|
||||
_cache[key] = ues
|
||||
return ues
|
||||
|
||||
@ -1347,14 +1347,14 @@ class FormSemestre(models.ScoDocModel):
|
||||
etudid=etudid, formsemestre_id=self.id
|
||||
)
|
||||
.join(UniteEns)
|
||||
.order_by(UniteEns.numero)
|
||||
.order_by(UniteEns.numero, UniteEns.acronyme)
|
||||
.all()
|
||||
)
|
||||
# Validations BUT:
|
||||
vals_rcues = (
|
||||
ApcValidationRCUE.query.filter_by(etudid=etudid, formsemestre_id=self.id)
|
||||
.join(UniteEns, ApcValidationRCUE.ue1)
|
||||
.order_by(UniteEns.numero)
|
||||
.order_by(UniteEns.numero, UniteEns.acronyme)
|
||||
.all()
|
||||
)
|
||||
vals_annee = ( # issues de cette année scolaire seulement
|
||||
|
@ -386,7 +386,7 @@ class Module(models.ScoDocModel):
|
||||
ues = (
|
||||
self.formation.ues.filter_by(semestre_idx=self.ue.semestre_idx)
|
||||
.filter(UniteEns.type != UE_SPORT)
|
||||
.order_by(UniteEns.numero)
|
||||
.order_by(UniteEns.numero, UniteEns.acronyme)
|
||||
.all()
|
||||
)
|
||||
if not ues:
|
||||
|
@ -1332,19 +1332,7 @@ def _get_etud_ue_validations_html(etud: Identite, formsemestre: FormSemestre) ->
|
||||
"""HTML listant les validations d'UEs pour cet étudiant dans des formations de même
|
||||
code que celle du formsemestre indiqué.
|
||||
"""
|
||||
validations: list[ScolarFormSemestreValidation] = (
|
||||
ScolarFormSemestreValidation.query.filter_by(etudid=etud.id)
|
||||
.join(UniteEns)
|
||||
.join(Formation)
|
||||
.filter_by(formation_code=formsemestre.formation.formation_code)
|
||||
.order_by(
|
||||
sa.desc(UniteEns.semestre_idx),
|
||||
UniteEns.acronyme,
|
||||
sa.desc(ScolarFormSemestreValidation.event_date),
|
||||
)
|
||||
.all()
|
||||
)
|
||||
|
||||
validations = get_etud_ue_validations(etud, formsemestre.formation)
|
||||
if not validations:
|
||||
return ""
|
||||
return render_template(
|
||||
@ -1356,6 +1344,27 @@ def _get_etud_ue_validations_html(etud: Identite, formsemestre: FormSemestre) ->
|
||||
)
|
||||
|
||||
|
||||
def get_etud_ue_validations(
|
||||
etud: Identite, formation: Formation
|
||||
) -> list[ScolarFormSemestreValidation]:
|
||||
"""Retourne les validations d'UEs pour cet étudiant dans des formations de même
|
||||
code que celle indiquée.
|
||||
"""
|
||||
return (
|
||||
ScolarFormSemestreValidation.query.filter_by(etudid=etud.id)
|
||||
.join(UniteEns)
|
||||
.join(Formation)
|
||||
.filter_by(formation_code=formation.formation_code)
|
||||
.order_by(
|
||||
sa.desc(UniteEns.semestre_idx),
|
||||
UniteEns.numero,
|
||||
UniteEns.acronyme,
|
||||
sa.desc(ScolarFormSemestreValidation.event_date),
|
||||
)
|
||||
.all()
|
||||
)
|
||||
|
||||
|
||||
def do_formsemestre_validate_previous_ue(
|
||||
formsemestre: FormSemestre,
|
||||
etudid,
|
||||
|
Loading…
Reference in New Issue
Block a user