Attention une mise à jour du service Gitlab va être effectuée le mardi 14 décembre entre 13h30 et 14h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit e9f4b135 authored by Mikaël Salson's avatar Mikaël Salson
Browse files

Merge branch 'hotfix-s/fix_sample_set_sort' into 'dev'

sample_set.py SampleSet.py fix sample_set sorting

Closes #3359

See merge request !244
parents a05819e0 936a9f66
Pipeline #33083 canceled with stages
......@@ -189,13 +189,14 @@ def all():
factory = ModelFactory()
helper = factory.get_instance(type=type)
fields = helper.get_fields()
sort_fields = helper.get_sort_fields()
##sort result
reverse = False
if request.vars["reverse"] == "true" :
reverse = True
if "sort" in request.vars:
result = sorted(result, key = lambda row : row[request.vars["sort"]], reverse=reverse)
result = sorted(result, key = sort_fields[request.vars["sort"]]['call'], reverse=reverse)
else:
result = sorted(result, key = lambda row : row.id, reverse=not reverse)
......@@ -208,7 +209,7 @@ def all():
helper = helper,
group_ids = group_ids,
isAdmin = isAdmin,
reverse = False,
reverse = reverse,
step = step,
page = page)
......
......@@ -79,6 +79,12 @@ class SampleSet(object):
fields.append({'name': 'files', 'sort': 'file_count', 'call': self.get_files, 'width': 100, 'public': True})
return fields
def get_sort_fields(self):
fields = {}
for field in self.get_fields():
fields[field['sort']] = field
return fields
def get_reduced_fields(self):
fields = []
fields.append({'name': 'name', 'sort': 'name', 'call': self.get_name, 'width': 200, 'public': True})
......
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