forked from ScoDoc/ScoDoc
code cleaning
This commit is contained in:
parent
cf876ca0d3
commit
f4c776e9f3
@ -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"],
|
||||
)
|
||||
for etud in etuds
|
||||
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud.id
|
||||
)
|
||||
}">{etud.nomprenom}</a>"""
|
||||
for etud in sorted(etuds, key=attrgetter("sort_key"))
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -479,17 +479,18 @@ class TableRecap(tb.Table):
|
||||
for row in self.rows:
|
||||
etud = row.etud
|
||||
admission = etud.admission.first()
|
||||
first = True
|
||||
for cid, title in fields.items():
|
||||
cell = row.add_cell(
|
||||
cid,
|
||||
title,
|
||||
getattr(admission, cid) or "",
|
||||
"admission",
|
||||
)
|
||||
if first:
|
||||
cell.classes.append("admission_first")
|
||||
first = False
|
||||
if admission:
|
||||
first = True
|
||||
for cid, title in fields.items():
|
||||
cell = row.add_cell(
|
||||
cid,
|
||||
title,
|
||||
getattr(admission, cid) or "",
|
||||
"admission",
|
||||
)
|
||||
if first:
|
||||
cell.classes.append("admission_first")
|
||||
first = False
|
||||
|
||||
def add_cursus(self):
|
||||
"""Ajoute colonne avec code cursus, eg 'S1 S2 S1'
|
||||
|
Loading…
Reference in New Issue
Block a user