forked from ScoDoc/ScoDoc
code cleaning
This commit is contained in:
parent
9b23ba4c96
commit
e9234d958a
@ -28,7 +28,7 @@
|
||||
"""Opérations d'inscriptions aux modules (interface pour gérer options ou parcours)
|
||||
"""
|
||||
import collections
|
||||
from operator import itemgetter
|
||||
from operator import attrgetter
|
||||
|
||||
import flask
|
||||
from flask import url_for, g, request
|
||||
@ -671,7 +671,7 @@ def descr_inscrs_module(moduleimpl_id, set_all, partitions):
|
||||
gr.append((partition["partition_name"], grp))
|
||||
#
|
||||
d = []
|
||||
for (partition_name, grp) in gr:
|
||||
for partition_name, grp in gr:
|
||||
if grp:
|
||||
d.append("groupes de %s: %s" % (partition_name, ", ".join(grp)))
|
||||
r = []
|
||||
@ -683,25 +683,25 @@ def descr_inscrs_module(moduleimpl_id, set_all, partitions):
|
||||
return False, len(ins), " et ".join(r)
|
||||
|
||||
|
||||
def _fmt_etud_set(ins, max_list_size=7):
|
||||
def _fmt_etud_set(etudids, max_list_size=7) -> str:
|
||||
# max_list_size est le nombre max de noms d'etudiants listés
|
||||
# au delà, on indique juste le nombre, sans les noms.
|
||||
if len(ins) > max_list_size:
|
||||
return "%d étudiants" % len(ins)
|
||||
if len(etudids) > max_list_size:
|
||||
return f"{len(etudids)} étudiants"
|
||||
etuds = []
|
||||
for etudid in ins:
|
||||
etuds.append(sco_etud.get_etud_info(etudid=etudid, filled=True)[0])
|
||||
etuds.sort(key=itemgetter("nom"))
|
||||
for etudid in etudids:
|
||||
etud = Identite.query.get(etudid)
|
||||
if etud:
|
||||
etuds.append(etud)
|
||||
|
||||
return ", ".join(
|
||||
[
|
||||
'<a class="discretelink" href="%s">%s</a>'
|
||||
% (
|
||||
f"""<a class="discretelink" href="{
|
||||
url_for(
|
||||
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud["etudid"]
|
||||
),
|
||||
etud["nomprenom"],
|
||||
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud.id
|
||||
)
|
||||
for etud in etuds
|
||||
}">{etud.nomprenom}</a>"""
|
||||
for etud in sorted(etuds, key=attrgetter("sort_key"))
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -479,6 +479,7 @@ class TableRecap(tb.Table):
|
||||
for row in self.rows:
|
||||
etud = row.etud
|
||||
admission = etud.admission.first()
|
||||
if admission:
|
||||
first = True
|
||||
for cid, title in fields.items():
|
||||
cell = row.add_cell(
|
||||
|
Loading…
Reference in New Issue
Block a user