ordre des UE (et coefs)

This commit is contained in:
Emmanuel Viennet 2021-12-10 01:55:13 +01:00
parent 0c49cfaf78
commit c332f1cee7
3 changed files with 10 additions and 4 deletions

View File

@ -137,7 +137,7 @@ class FormSemestre(db.Model):
)
if not with_sport:
sem_ues = sem_ues.filter(UniteEns.type != sco_codes_parcours.UE_SPORT)
return sem_ues
return sem_ues.order_by(UniteEns.numero)
def est_courant(self) -> bool:
"""Vrai si la date actuelle (now) est dans le semestre

View File

@ -111,9 +111,15 @@ class Module(db.Model):
db.session.delete(ue_coef)
self.formation.invalidate_module_coefs()
def get_ue_coefs_sorted(self):
"les coefs d'UE, trié par numéro d'UE"
# je n'ai pas su mettre un order_by sur le backref sans avoir
# à redéfinir les relationships...
return sorted(self.ue_coefs, key=lambda x: x.ue.numero)
def ue_coefs_descr(self):
"""List of tuples [ (ue_acronyme, coef) ]"""
return [(c.ue.acronyme, c.coef) for c in self.ue_coefs]
return [(c.ue.acronyme, c.coef) for c in self.get_ue_coefs_sorted()]
class ModuleUECoef(db.Model):

View File

@ -20,11 +20,11 @@
title="{{sco.sem.responsables_str(abbrev_prenom=False)}}">{{sco.sem.responsables_str()}}</a></span>
<span class="nbinscrits"><a class="discretelink" href="{{url_for('scolar.groups_view', scodoc_dept=g.scodoc_dept,
formsemestre_id=sco.sem.id)}}">{{sco.sem.inscriptions|length}} inscrits</a></span><span class="lock">{% if
sco.sem.etat %}<a href="{{url_for(" notes.formsemestre_change_lock", scodoc_dept=g.scodoc_dept,
sco.sem.etat %}<a href="{{url_for('notes.formsemestre_change_lock', scodoc_dept=g.scodoc_dept,
formsemestre_id=sco.sem.id)}}">{{sco.scu.icontag("lock_img", border="0", title="Semestre
verrouillé")|safe}}</a>{% endif %}</span><span class="eye">
{% if sco.prefs["bul_display_publication"] %}
<a href="{{url_for(" notes.formsemestre_change_publication_bul", scodoc_dept=g.scodoc_dept,
<a href="{{url_for('notes.formsemestre_change_publication_bul', scodoc_dept=g.scodoc_dept,
formsemestre_id=sco.sem.id)}}">
{% if sco.sem.bul_hide_xml %}
{{ sco.scu.icontag("hide_img", border="0", title="Bulletins NON publiés")|safe}}