Commit c08c1d47 authored by dario's avatar dario
Browse files

backend/db: fix incorrect adaption of python2 compare to python3 keyfunc

we can't always multiply the keyfunc result (i.e. field to be compared)
with -1, because not all fields are numeric (e.g. lecturer name);

the correct way to reverse the sort order is just to tell `sort` ;-)
parent 5095383b
......@@ -212,7 +212,7 @@ class Database:
if not keyfunc:
keyfunc = lambda x: x[field]
ret.__entries.sort(key=(keyfunc if order=="ASC" else lambda x: -1 * keyfunc(x)))
ret.__entries.sort(key=keyfunc, reverse=(order!="ASC"))
return ret
def collect_unique_field(self, field="name"):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment