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

Merge branch 'feature-s/4240-4241-sort-configs' into 'dev'

Sort configurations, by classification then by name, and also for admins

Closes #4240 and #4241

See merge request !655
parents 7528658c 84a07ba0
Pipeline #139500 passed with stages
in 8 minutes and 16 seconds
......@@ -15,7 +15,7 @@ def index():
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
query = db((auth.vidjil_accessible_query(PermissionEnum.read_config.value, db.config) | auth.vidjil_accessible_query(PermissionEnum.admin_config.value, db.config) ) ).select(orderby=~db.config.name)
query = db((auth.vidjil_accessible_query(PermissionEnum.read_config.value, db.config) | auth.vidjil_accessible_query(PermissionEnum.admin_config.value, db.config) ) ).select(orderby=db.config.classification|db.config.name)
used_query = db(db.results_file.config_id > 0).select(db.results_file.config_id, distinct=True)
used_configs = [row.config_id for row in used_query]
classification = db( (db.classification) ).select()
......
......@@ -703,7 +703,7 @@ def getConfigsByClassification():
classification = defaultdict( lambda: {"info":"", "name":"", "configs":[]} )
if auth.can_process_sample_set(request.vars['id']) :
for class_elt in db( (db.classification)).select(orderby=db.classification.id):
configs = db( (db.config.classification == class_elt.id) & (auth.vidjil_accessible_query(PermissionEnum.read.value, db.config) | auth.vidjil_accessible_query(PermissionEnum.admin.value, db.config) ) ).select(orderby=db.config.id)
configs = db( (db.config.classification == class_elt.id) & (auth.vidjil_accessible_query(PermissionEnum.read.value, db.config) | auth.vidjil_accessible_query(PermissionEnum.admin.value, db.config) ) ).select(orderby=db.config.name)
if len(configs): # don't show empty optgroup
classification["%02d_%s" % (i, class_elt)]["name"] = class_elt.name
classification["%02d_%s" % (i, class_elt)]["info"] = class_elt.info
......@@ -711,7 +711,7 @@ def getConfigsByClassification():
i += 1
classification["%02d_noclass" % i]["name"] = "–"
classification["%02d_noclass" % i]["info"] = ""
classification["%02d_noclass" % i]["configs"] = db( (db.config.classification == None) & (auth.vidjil_accessible_query(PermissionEnum.read.value, db.config) | auth.vidjil_accessible_query(PermissionEnum.admin.value, db.config) ) ).select(orderby=db.config.id)
classification["%02d_noclass" % i]["configs"] = db( (db.config.classification == None) & (auth.vidjil_accessible_query(PermissionEnum.read.value, db.config) | auth.vidjil_accessible_query(PermissionEnum.admin.value, db.config) ) ).select(orderby=db.config.name)
return classification
def getStatHeaders():
......
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