forked from ScoDoc/ScoDoc
sort: removed cmp argument
This commit is contained in:
parent
aea498fa86
commit
510e6dc9c7
@ -31,6 +31,7 @@ from types import StringType, FloatType
|
|||||||
import time
|
import time
|
||||||
import pdb
|
import pdb
|
||||||
import inspect
|
import inspect
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
@ -207,7 +208,7 @@ class NotesTable:
|
|||||||
x["nomp"] = (i["nom_usuel"] or i["nom"]) + i["prenom"] # pour tri
|
x["nomp"] = (i["nom_usuel"] or i["nom"]) + i["prenom"] # pour tri
|
||||||
|
|
||||||
# Tri les etudids par NOM
|
# Tri les etudids par NOM
|
||||||
self.inscrlist.sort(lambda x, y: cmp(x["nomp"], y["nomp"]))
|
self.inscrlist.sort(key=itemgetter("nomp"))
|
||||||
|
|
||||||
# { etudid : rang dans l'ordre alphabetique }
|
# { etudid : rang dans l'ordre alphabetique }
|
||||||
rangalpha = {}
|
rangalpha = {}
|
||||||
@ -306,33 +307,18 @@ class NotesTable:
|
|||||||
T.append(tuple(t))
|
T.append(tuple(t))
|
||||||
# tri par moyennes décroissantes,
|
# tri par moyennes décroissantes,
|
||||||
# en laissant les demissionnaires a la fin, par ordre alphabetique
|
# en laissant les demissionnaires a la fin, par ordre alphabetique
|
||||||
def cmprows(x, y):
|
def row_key(x):
|
||||||
|
"""clé de tri par moyennes décroissantes,
|
||||||
|
en laissant les demissionnaires a la fin, par ordre alphabetique.
|
||||||
|
(moy_gen, rang_alpha)
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
return cmp(float(y[0]), float(x[0])) # moy. gen.
|
moy = -float(x[0])
|
||||||
except:
|
except (ValueError, TypeError):
|
||||||
vx, vy = x[0], y[0]
|
moy = 1000.0
|
||||||
try:
|
return (moy, rangalpha[x[-1]])
|
||||||
vx = float(vx)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
vy = float(vy)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if type(vx) == type(vy): # and type(vx) == StringType:
|
T.sort(key=row_key)
|
||||||
# rang alphabetique par nom
|
|
||||||
return rangalpha[x[-1]] - rangalpha[y[-1]]
|
|
||||||
else:
|
|
||||||
# Laisse les chaines a la fin de la liste
|
|
||||||
return cmp(str(type(vx)), str(type(vy))) # A revoir !
|
|
||||||
# fallback *** should not occur ***
|
|
||||||
# txt = '\nkey missing in cmprows !!!\nx=%s\ny=%s\n' % (str(x),str(y))
|
|
||||||
# txt += '\nrangalpha=%s' % str(rangalpha) + '\n\nT=%s' % str(T)
|
|
||||||
# send_debug_alert(txt, REQUEST=None)
|
|
||||||
# return cmp(x,y)
|
|
||||||
|
|
||||||
T.sort(cmprows)
|
|
||||||
self.T = T
|
self.T = T
|
||||||
|
|
||||||
if len(valid_moy):
|
if len(valid_moy):
|
||||||
@ -363,7 +349,7 @@ class NotesTable:
|
|||||||
ue_eff = len(
|
ue_eff = len(
|
||||||
[x for x in val_ids if type(x[0]) == FloatType]
|
[x for x in val_ids if type(x[0]) == FloatType]
|
||||||
) # nombre d'étudiants avec une note dans l'UE
|
) # nombre d'étudiants avec une note dans l'UE
|
||||||
val_ids.sort(cmprows)
|
val_ids.sort(key=row_key)
|
||||||
ue_rangs[ue_id] = (
|
ue_rangs[ue_id] = (
|
||||||
comp_ranks(val_ids),
|
comp_ranks(val_ids),
|
||||||
ue_eff,
|
ue_eff,
|
||||||
@ -374,7 +360,7 @@ class NotesTable:
|
|||||||
for modimpl in self._modimpls:
|
for modimpl in self._modimpls:
|
||||||
vals = self._modmoys[modimpl["moduleimpl_id"]]
|
vals = self._modmoys[modimpl["moduleimpl_id"]]
|
||||||
val_ids = [(vals[etudid], etudid) for etudid in vals.keys()]
|
val_ids = [(vals[etudid], etudid) for etudid in vals.keys()]
|
||||||
val_ids.sort(cmprows)
|
val_ids.sort(key=row_key)
|
||||||
self.mod_rangs[modimpl["moduleimpl_id"]] = (comp_ranks(val_ids), len(vals))
|
self.mod_rangs[modimpl["moduleimpl_id"]] = (comp_ranks(val_ids), len(vals))
|
||||||
#
|
#
|
||||||
self.compute_moy_moy()
|
self.compute_moy_moy()
|
||||||
@ -483,14 +469,7 @@ class NotesTable:
|
|||||||
r = [m for m in self._modimpls if m["ue"]["ue_id"] == ue_id]
|
r = [m for m in self._modimpls if m["ue"]["ue_id"] == ue_id]
|
||||||
# trie la liste par ue.numero puis mat.numero puis mod.numero
|
# trie la liste par ue.numero puis mat.numero puis mod.numero
|
||||||
r.sort(
|
r.sort(
|
||||||
lambda x, y: cmp(
|
key=lambda x: (x["ue"]["numero"], x["mat"]["numero"], x["module"]["numero"])
|
||||||
x["ue"]["numero"] * 1000000
|
|
||||||
+ x["mat"]["numero"] * 1000
|
|
||||||
+ x["module"]["numero"],
|
|
||||||
y["ue"]["numero"] * 1000000
|
|
||||||
+ y["mat"]["numero"] * 1000
|
|
||||||
+ y["module"]["numero"],
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
"""
|
"""
|
||||||
# codes anciens déplacés de ZEntreprise
|
# codes anciens déplacés de ZEntreprise
|
||||||
import datetime
|
import datetime
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
@ -94,7 +95,7 @@ class EntreprisesEditor(EditableTable):
|
|||||||
else:
|
else:
|
||||||
r["date"] = datetime.date.min
|
r["date"] = datetime.date.min
|
||||||
# sort
|
# sort
|
||||||
R.sort(lambda r1, r2: cmp(r2["date"], r1["date"]))
|
R.sort(key=itemgetter("date"))
|
||||||
for r in R:
|
for r in R:
|
||||||
r["date"] = DateISOtoDMY(r["date"])
|
r["date"] = DateISOtoDMY(r["date"])
|
||||||
return R
|
return R
|
||||||
@ -122,11 +123,8 @@ class EntreprisesEditor(EditableTable):
|
|||||||
R.append(d)
|
R.append(d)
|
||||||
# sort
|
# sort
|
||||||
if sort_on_contact:
|
if sort_on_contact:
|
||||||
R.sort(
|
R.sort(key=lambda x: (x["date"] or datetime.date.min))
|
||||||
lambda r1, r2: cmp(
|
|
||||||
r2["date"] or datetime.date.min, r1["date"] or datetime.date.min
|
|
||||||
)
|
|
||||||
)
|
|
||||||
for r in R:
|
for r in R:
|
||||||
r["date"] = DateISOtoDMY(r["date"] or datetime.date.min)
|
r["date"] = DateISOtoDMY(r["date"] or datetime.date.min)
|
||||||
return R
|
return R
|
||||||
|
@ -36,6 +36,7 @@ from email.mime.multipart import MIMEMultipart
|
|||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
from email.header import Header
|
from email.header import Header
|
||||||
from email.mime.base import MIMEBase
|
from email.mime.base import MIMEBase
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
from app.scodoc import sco_emails
|
from app.scodoc import sco_emails
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
@ -605,7 +606,7 @@ class EtudIdentEditor:
|
|||||||
}
|
}
|
||||||
res[-1].update(void_adm)
|
res[-1].update(void_adm)
|
||||||
# tri par nom
|
# tri par nom
|
||||||
res.sort(lambda x, y: cmp(x["nom"] + x["prenom"], y["nom"] + y["prenom"]))
|
res.sort(key=itemgetter("nom", "prenom"))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def edit(self, cnx, args, context=None, REQUEST=None):
|
def edit(self, cnx, args, context=None, REQUEST=None):
|
||||||
@ -937,7 +938,7 @@ def fill_etuds_info(etuds):
|
|||||||
sems.append(sem)
|
sems.append(sem)
|
||||||
# trie les semestres par date de debut, le plus recent d'abord
|
# trie les semestres par date de debut, le plus recent d'abord
|
||||||
# (important, ne pas changer (suivi cohortes))
|
# (important, ne pas changer (suivi cohortes))
|
||||||
sems.sort(lambda x, y: cmp(y["dateord"], x["dateord"]))
|
sems.sort(key=itemgetter("dateord"), reverse=True)
|
||||||
etud["sems"] = sems
|
etud["sems"] = sems
|
||||||
etud["cursem"] = cursem
|
etud["cursem"] = cursem
|
||||||
if cursem:
|
if cursem:
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
"""Operations de base sur les formsemestres
|
"""Operations de base sur les formsemestres
|
||||||
"""
|
"""
|
||||||
import time
|
import time
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
from scodoc_manager import sco_mgr
|
from scodoc_manager import sco_mgr
|
||||||
from app.scodoc import sco_codes_parcours
|
from app.scodoc import sco_codes_parcours
|
||||||
@ -118,12 +119,8 @@ def do_formsemestre_list(context, *a, **kw):
|
|||||||
for sem in sems:
|
for sem in sems:
|
||||||
formsemestre_enrich(context, sem)
|
formsemestre_enrich(context, sem)
|
||||||
|
|
||||||
# tri par date
|
# tri par date, le plus récent d'abord
|
||||||
sems.sort(
|
sems.sort(key=itemgetter("dateord", "semestre_id"), reverse=True)
|
||||||
lambda x, y: cmp(
|
|
||||||
(y["dateord"], y["semestre_id"]), (x["dateord"], x["semestre_id"])
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
return sems
|
return sems
|
||||||
|
|
||||||
|
@ -33,6 +33,16 @@ from types import FloatType, IntType, LongType, StringType
|
|||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
|
||||||
|
|
||||||
|
def cmp(x, y):
|
||||||
|
"""
|
||||||
|
Replacement for built-in function cmp that was removed in Python 3
|
||||||
|
Compare the two objects x and y and return an integer according to
|
||||||
|
the outcome. The return value is negative if x < y, zero if x == y
|
||||||
|
and strictly positive if x > y.
|
||||||
|
"""
|
||||||
|
return (x > y) - (x < y)
|
||||||
|
|
||||||
|
|
||||||
class NoteVector(object):
|
class NoteVector(object):
|
||||||
"""Vecteur de notes (ou coefficients) utilisé pour les formules définies par l'utilisateur.
|
"""Vecteur de notes (ou coefficients) utilisé pour les formules définies par l'utilisateur.
|
||||||
Les éléments sont accessibles soit par index v[i], soit par leur nom v['nom'] s'il en ont un.
|
Les éléments sont accessibles soit par index v[i], soit par leur nom v['nom'] s'il en ont un.
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
Utilise les autorisations d'inscription délivrées en jury.
|
Utilise les autorisations d'inscription délivrées en jury.
|
||||||
"""
|
"""
|
||||||
import datetime
|
import datetime
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
@ -301,7 +302,7 @@ def formsemestre_inscr_passage(
|
|||||||
|
|
||||||
def set_to_sorted_etud_list(etudset):
|
def set_to_sorted_etud_list(etudset):
|
||||||
etuds = [candidats[etudid] for etudid in etudset]
|
etuds = [candidats[etudid] for etudid in etudset]
|
||||||
etuds.sort(lambda x, y: cmp(x["nom"], y["nom"]))
|
etuds.sort(key=itemgetter("nom"))
|
||||||
return etuds
|
return etuds
|
||||||
|
|
||||||
if submitted:
|
if submitted:
|
||||||
@ -522,8 +523,7 @@ def etuds_select_boxes(
|
|||||||
infos["comment"] = infos.get("comment", "") # commentaire dans sous-titre boite
|
infos["comment"] = infos.get("comment", "") # commentaire dans sous-titre boite
|
||||||
help = infos.get("help", "")
|
help = infos.get("help", "")
|
||||||
etuds = auth_etuds_by_cat[src_cat]["etuds"]
|
etuds = auth_etuds_by_cat[src_cat]["etuds"]
|
||||||
etuds.sort(lambda x, y: cmp(x["nom"], y["nom"]))
|
etuds.sort(key=itemgetter("nom"))
|
||||||
|
|
||||||
with_checkbox = (not read_only) and auth_etuds_by_cat[src_cat]["infos"].get(
|
with_checkbox = (not read_only) and auth_etuds_by_cat[src_cat]["infos"].get(
|
||||||
"with_checkbox", True
|
"with_checkbox", True
|
||||||
)
|
)
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
"""
|
"""
|
||||||
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
||||||
from types import StringType
|
from types import StringType
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
@ -512,7 +513,7 @@ def _make_table_notes(
|
|||||||
'<td style="padding-left: 50px; vertical-align: top;"><p>',
|
'<td style="padding-left: 50px; vertical-align: top;"><p>',
|
||||||
]
|
]
|
||||||
commentkeys = list(K.items()) # [ (comment, key), ... ]
|
commentkeys = list(K.items()) # [ (comment, key), ... ]
|
||||||
commentkeys.sort(lambda x, y: cmp(int(x[1]), int(y[1])))
|
commentkeys.sort(key=lambda x: int(x[1]))
|
||||||
for (comment, key) in commentkeys:
|
for (comment, key) in commentkeys:
|
||||||
C.append(
|
C.append(
|
||||||
'<span class="colcomment">(%s)</span> <em>%s</em><br/>' % (key, comment)
|
'<span class="colcomment">(%s)</span> <em>%s</em><br/>' % (key, comment)
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
- statistiques decisions
|
- statistiques decisions
|
||||||
- suivi cohortes
|
- suivi cohortes
|
||||||
"""
|
"""
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
@ -112,12 +113,7 @@ def _table_etuds_lycees(
|
|||||||
for l in L:
|
for l in L:
|
||||||
l["nbetuds"] = len(etuds_by_lycee[l["codelycee"]])
|
l["nbetuds"] = len(etuds_by_lycee[l["codelycee"]])
|
||||||
# L.sort( key=operator.itemgetter('codepostallycee', 'nomlycee') ) argh, only python 2.5+ !!!
|
# L.sort( key=operator.itemgetter('codepostallycee', 'nomlycee') ) argh, only python 2.5+ !!!
|
||||||
L.sort(
|
L.sort(key=itemgetter("codepostallycee", "nomlycee"))
|
||||||
cmp=lambda x, y: cmp(
|
|
||||||
(x["codepostallycee"], x["nomlycee"]),
|
|
||||||
(y["codepostallycee"], y["nomlycee"]),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
columns_ids = (
|
columns_ids = (
|
||||||
"nbetuds",
|
"nbetuds",
|
||||||
"codelycee",
|
"codelycee",
|
||||||
|
@ -153,7 +153,8 @@ def do_moduleimpl_withmodule_list(
|
|||||||
)[0]
|
)[0]
|
||||||
|
|
||||||
# tri par semestre/UE/numero_matiere/numero_module
|
# tri par semestre/UE/numero_matiere/numero_module
|
||||||
extr = lambda x: (
|
modimpls.sort(
|
||||||
|
key=lambda x: (
|
||||||
x["ue"]["numero"],
|
x["ue"]["numero"],
|
||||||
x["ue"]["ue_id"],
|
x["ue"]["ue_id"],
|
||||||
x["matiere"]["numero"],
|
x["matiere"]["numero"],
|
||||||
@ -161,7 +162,7 @@ def do_moduleimpl_withmodule_list(
|
|||||||
x["module"]["numero"],
|
x["module"]["numero"],
|
||||||
x["module"]["code"],
|
x["module"]["code"],
|
||||||
)
|
)
|
||||||
modimpls.sort(lambda x, y: cmp(extr(x), extr(y)))
|
)
|
||||||
|
|
||||||
return scu.return_text_if_published(modimpls, REQUEST)
|
return scu.return_text_if_published(modimpls, REQUEST)
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
"""Opérations d'inscriptions aux modules (interface pour gérer options ou parcours)
|
"""Opérations d'inscriptions aux modules (interface pour gérer options ou parcours)
|
||||||
"""
|
"""
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
@ -105,7 +105,7 @@ def moduleimpl_inscriptions_edit(
|
|||||||
"Etudiant %s inscrit mais inconnu dans la base !!!!!" % ins["etudid"]
|
"Etudiant %s inscrit mais inconnu dans la base !!!!!" % ins["etudid"]
|
||||||
)
|
)
|
||||||
ins["etud"] = etuds_info[0]
|
ins["etud"] = etuds_info[0]
|
||||||
inscrits.sort(lambda x, y: cmp(x["etud"]["nom"], y["etud"]["nom"]))
|
inscrits.sort(key=lambda x: x["etud"]["nom"])
|
||||||
in_m = sco_moduleimpl.do_moduleimpl_inscription_list(
|
in_m = sco_moduleimpl.do_moduleimpl_inscription_list(
|
||||||
context, moduleimpl_id=M["moduleimpl_id"]
|
context, moduleimpl_id=M["moduleimpl_id"]
|
||||||
)
|
)
|
||||||
@ -458,7 +458,7 @@ def _fmt_etud_set(context, ins, max_list_size=7):
|
|||||||
etuds = []
|
etuds = []
|
||||||
for etudid in ins:
|
for etudid in ins:
|
||||||
etuds.append(sco_etud.get_etud_info(etudid=etudid, filled=True)[0])
|
etuds.append(sco_etud.get_etud_info(etudid=etudid, filled=True)[0])
|
||||||
etuds.sort(lambda x, y: cmp(x["nom"], y["nom"]))
|
etuds.sort(itemgetter("nom"))
|
||||||
return ", ".join(
|
return ", ".join(
|
||||||
[
|
[
|
||||||
'<a class="discretelink" href="ficheEtud?etudid=%(etudid)s">%(nomprenom)s</a>'
|
'<a class="discretelink" href="ficheEtud?etudid=%(etudid)s">%(nomprenom)s</a>'
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
"""Gestions des "nouvelles"
|
"""Gestion des "nouvelles"
|
||||||
"""
|
"""
|
||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
@ -34,6 +34,7 @@ from cStringIO import StringIO
|
|||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
from email.header import Header
|
from email.header import Header
|
||||||
|
from operator import itemgetter
|
||||||
from stripogram import html2text
|
from stripogram import html2text
|
||||||
import PyRSS2Gen # pylint: disable=import-error
|
import PyRSS2Gen # pylint: disable=import-error
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ def scolar_news_summary(context, n=5):
|
|||||||
|
|
||||||
news = list(selected_news.values())
|
news = list(selected_news.values())
|
||||||
# sort by date, descending
|
# sort by date, descending
|
||||||
news.sort(lambda x, y: cmp(y["date"], x["date"]))
|
news.sort(itemgetter("date"), reverse=True)
|
||||||
news = news[:n]
|
news = news[:n]
|
||||||
# mimic EditableTable.list output formatting:
|
# mimic EditableTable.list output formatting:
|
||||||
for n in news:
|
for n in news:
|
||||||
|
@ -137,16 +137,14 @@ def feuille_preparation_jury(context, formsemestre_id, REQUEST):
|
|||||||
# Codes des UE "semestre précédent":
|
# Codes des UE "semestre précédent":
|
||||||
ue_prev_codes = list(prev_moy_ue.keys())
|
ue_prev_codes = list(prev_moy_ue.keys())
|
||||||
ue_prev_codes.sort(
|
ue_prev_codes.sort(
|
||||||
lambda x, y, prev_ue_acro=prev_ue_acro: cmp( # pylint: disable=undefined-variable
|
key=lambda x, prev_ue_acro=prev_ue_acro: prev_ue_acro[ # pylint: disable=undefined-variable
|
||||||
prev_ue_acro[x], prev_ue_acro[y]
|
x
|
||||||
)
|
]
|
||||||
)
|
)
|
||||||
# Codes des UE "semestre courant":
|
# Codes des UE "semestre courant":
|
||||||
ue_codes = list(moy_ue.keys())
|
ue_codes = list(moy_ue.keys())
|
||||||
ue_codes.sort(
|
ue_codes.sort(
|
||||||
lambda x, y, ue_acro=ue_acro: cmp( # pylint: disable=undefined-variable
|
key=lambda x, ue_acro=ue_acro: ue_acro[x] # pylint: disable=undefined-variable
|
||||||
ue_acro[x], ue_acro[y]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
sid = sem["semestre_id"]
|
sid = sem["semestre_id"]
|
||||||
|
@ -47,6 +47,7 @@ Jury de semestre n
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
from operator import itemgetter
|
||||||
from reportlab.platypus import Paragraph
|
from reportlab.platypus import Paragraph
|
||||||
from reportlab.lib import styles
|
from reportlab.lib import styles
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ def _descr_decisions_ues(context, nt, etudid, decisions_ue, decision_sem):
|
|||||||
uelist.append(nt.get_etud_ue_status(etudid, ue["ue_id"])["ue"])
|
uelist.append(nt.get_etud_ue_status(etudid, ue["ue_id"])["ue"])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
uelist.sort(lambda x, y: cmp(x["numero"], y["numero"]))
|
uelist.sort(itemgetter("numero"))
|
||||||
|
|
||||||
return uelist
|
return uelist
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
|||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
from app.scodoc import notesdb as ndb
|
from app.scodoc import notesdb as ndb
|
||||||
@ -453,7 +454,7 @@ def table_suivi_cohorte(
|
|||||||
for s in sems:
|
for s in sems:
|
||||||
d, m, y = [int(x) for x in s["date_debut"].split("/")]
|
d, m, y = [int(x) for x in s["date_debut"].split("/")]
|
||||||
s["date_debut_dt"] = datetime.datetime(y, m, d)
|
s["date_debut_dt"] = datetime.datetime(y, m, d)
|
||||||
sems.sort(lambda x, y: cmp(x["date_debut_dt"], y["date_debut_dt"]))
|
sems.sort(key=itemgetter("date_debut_dt"))
|
||||||
|
|
||||||
# 2-- Pour chaque semestre, trouve l'ensemble des etudiants venant de sem
|
# 2-- Pour chaque semestre, trouve l'ensemble des etudiants venant de sem
|
||||||
logt("B: etuds sets")
|
logt("B: etuds sets")
|
||||||
@ -910,7 +911,7 @@ def _descr_etud_set(context, etudids):
|
|||||||
for etudid in etudids:
|
for etudid in etudids:
|
||||||
etuds.append(sco_etud.get_etud_info(etudid=etudid, filled=True)[0])
|
etuds.append(sco_etud.get_etud_info(etudid=etudid, filled=True)[0])
|
||||||
# sort by name
|
# sort by name
|
||||||
etuds.sort(lambda x, y: cmp(x["nom"], y["nom"]))
|
etuds.sort(itemgetter("nom"))
|
||||||
return ", ".join([e["nomprenom"] for e in etuds])
|
return ", ".join([e["nomprenom"] for e in etuds])
|
||||||
|
|
||||||
|
|
||||||
@ -1077,7 +1078,7 @@ def tsp_grouped_list(context, codes_etuds):
|
|||||||
)
|
)
|
||||||
L.append(l)
|
L.append(l)
|
||||||
# tri par effectifs décroissants
|
# tri par effectifs décroissants
|
||||||
L.sort(lambda x, y: cmp(y["nb"], x["nb"]))
|
L.sort(key=itemgetter("nb"))
|
||||||
return L
|
return L
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
import pprint
|
import pprint
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
@ -423,7 +424,7 @@ def list_synch(context, sem, anneeapogee=None):
|
|||||||
return etud
|
return etud
|
||||||
|
|
||||||
etuds = [key2etud(x, etud_apo) for x in etudset]
|
etuds = [key2etud(x, etud_apo) for x in etudset]
|
||||||
etuds.sort(lambda x, y: cmp(x["nom"], y["nom"]))
|
etuds.sort(itemgetter("nom"))
|
||||||
return etuds
|
return etuds
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -35,6 +35,7 @@ import time
|
|||||||
import datetime
|
import datetime
|
||||||
import jaxml
|
import jaxml
|
||||||
import pprint
|
import pprint
|
||||||
|
from operator import itemgetter
|
||||||
|
|
||||||
from flask import url_for, g
|
from flask import url_for, g
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
@ -1207,7 +1208,7 @@ def formsemestre_enseignants_list(context, REQUEST, formsemestre_id, format="htm
|
|||||||
sem_ens[ens]["_email_target"] = "mailto:%s" % sem_ens[ens]["email"]
|
sem_ens[ens]["_email_target"] = "mailto:%s" % sem_ens[ens]["email"]
|
||||||
|
|
||||||
sem_ens_list = list(sem_ens.values())
|
sem_ens_list = list(sem_ens.values())
|
||||||
sem_ens_list.sort(lambda x, y: cmp(x["nomprenom"], y["nomprenom"]))
|
sem_ens_list.sort(itemgetter("nomprenom"))
|
||||||
|
|
||||||
# --- Generate page with table
|
# --- Generate page with table
|
||||||
title = "Enseignants de " + sem["titremois"]
|
title = "Enseignants de " + sem["titremois"]
|
||||||
|
Loading…
Reference in New Issue
Block a user