forked from ScoDoc/ScoDoc
Tri tables sans diacritiques. Closes #122
This commit is contained in:
parent
795de44c0c
commit
83d538e2a2
@ -469,10 +469,12 @@ class ResultatsSemestre(ResultatsCache):
|
||||
idx = add_cell(
|
||||
row, "nom_disp", "Nom", etud.nom_disp(), "identite_detail", idx
|
||||
)
|
||||
row["_nom_disp_order"] = etud.sort_key
|
||||
idx = add_cell(row, "prenom", "Prénom", etud.prenom, "identite_detail", idx)
|
||||
idx = add_cell(
|
||||
row, "nom_short", "Nom", etud.nom_short, "identite_court", idx
|
||||
)
|
||||
row["_nom_short_order"] = etud.sort_key
|
||||
row["_nom_short_target"] = url_for(
|
||||
"notes.formsemestre_bulletinetud",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
|
@ -131,7 +131,10 @@ class Identite(db.Model):
|
||||
@cached_property
|
||||
def sort_key(self) -> tuple:
|
||||
"clé pour tris par ordre alphabétique"
|
||||
return (self.nom_usuel or self.nom).lower(), self.prenom.lower()
|
||||
return (
|
||||
scu.suppress_accents(self.nom_usuel or self.nom or "").lower(),
|
||||
scu.suppress_accents(self.prenom or "").lower(),
|
||||
)
|
||||
|
||||
def get_first_email(self, field="email") -> str:
|
||||
"Le mail associé à la première adrese de l'étudiant, ou None"
|
||||
|
@ -41,6 +41,7 @@ from app.comp.moy_mod import ModuleImplResults
|
||||
from app.comp.res_compat import NotesTableCompat
|
||||
from app.comp.res_but import ResultatsSemestreBUT
|
||||
from app.models import FormSemestre
|
||||
from app.models.etudiants import Identite
|
||||
from app.models.evaluations import Evaluation
|
||||
from app.models.moduleimpls import ModuleImpl
|
||||
import app.scodoc.sco_utils as scu
|
||||
@ -53,7 +54,6 @@ from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import sco_groups
|
||||
from app.scodoc import sco_moduleimpl
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_etud
|
||||
from app.scodoc import sco_users
|
||||
import sco_version
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
@ -320,7 +320,9 @@ def _make_table_notes(
|
||||
for etudid, etat in etudid_etats:
|
||||
css_row_class = None
|
||||
# infos identite etudiant
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||
etud = Identite.query.get(etudid)
|
||||
if etud is None:
|
||||
continue
|
||||
|
||||
if etat == "I": # si inscrit, indique groupe
|
||||
groups = sco_groups.get_etud_groups(etudid, modimpl_o["formsemestre_id"])
|
||||
@ -332,7 +334,7 @@ def _make_table_notes(
|
||||
else:
|
||||
grc = etat
|
||||
|
||||
code = etud.get(anonymous_lst_key)
|
||||
code = getattr(etud, anonymous_lst_key)
|
||||
if not code: # laisser le code vide n'aurait aucun sens, prenons l'etudid
|
||||
code = etudid
|
||||
|
||||
@ -341,20 +343,20 @@ def _make_table_notes(
|
||||
"code": str(code), # INE, NIP ou etudid
|
||||
"_code_td_attrs": 'style="padding-left: 1em; padding-right: 2em;"',
|
||||
"etudid": etudid,
|
||||
"nom": etud["nom"].upper(),
|
||||
"nom": etud.nom.upper(),
|
||||
"_nomprenom_target": url_for(
|
||||
"notes.formsemestre_bulletinetud",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formsemestre_id=modimpl_o["formsemestre_id"],
|
||||
etudid=etudid,
|
||||
),
|
||||
"_nomprenom_td_attrs": f"""id="{etudid}" class="etudinfo" data-sort="{etud.get('nom', '').upper()}" """,
|
||||
"prenom": etud["prenom"].lower().capitalize(),
|
||||
"nomprenom": etud["nomprenom"],
|
||||
"_nomprenom_td_attrs": f"""id="{etudid}" class="etudinfo" data-sort="{etud.sort_key}" """,
|
||||
"prenom": etud.prenom.lower().capitalize(),
|
||||
"nomprenom": etud.nomprenom,
|
||||
"group": grc,
|
||||
"_group_td_attrs": 'class="group"',
|
||||
"email": etud["email"],
|
||||
"emailperso": etud["emailperso"],
|
||||
"email": etud.get_first_email(),
|
||||
"emailperso": etud.get_first_email("emailperso"),
|
||||
"_css_row_class": css_row_class or "",
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user