Commit 3f195399 authored by Ryan Herbert's avatar Ryan Herbert
Browse files

autocomplete samples order by sample_set_id desc

See #3016
parent 7d2840f7
......@@ -140,6 +140,7 @@ VidjilAutoComplete.prototype = {
}
var res = $.map(data, function(i) {
return {
id: i.id,
name: i.name,
search: i.name
};
......@@ -177,6 +178,17 @@ VidjilAutoComplete.prototype = {
return "";
};
callbacks.sorter = function(query, items) {
return items.sort(function(a, b){
if(a.id < b.id) {
return 1;
} else if (a.id == b.id) {
return 0
}
return -1;
});
};
$input.atwho({
at: at,
alias: 'samples',
......
......@@ -761,7 +761,7 @@ def get_sample_set_list(type):
(db[type].sample_set_id == db.sample_set.id)
).select(
db[type].ALL, # sub optimal, use helpers to reduce ?
orderby = ~db[type].id
orderby = ~db[type].sample_set_id
)
ss_list = []
......@@ -769,7 +769,7 @@ def get_sample_set_list(type):
helper = factory.get_instance(type=type)
for row in query :
tmp = helper.get_id_string(row)
ss_list.append({'name':tmp})
ss_list.append({'name':tmp, 'id': row.sample_set_id})
return ss_list
def auto_complete():
......
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