forked from saurabh/personal-honor
sort fixes
This commit is contained in:
parent
af05f4dbf0
commit
2f6b6d62b1
|
@ -53,7 +53,7 @@ class Honor
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
plugin_datas = datas.sort_for_frontend.collect do |p|
|
plugin_datas = datas.sort_for_frontend.collect.with_index do |p,index|
|
||||||
|
|
||||||
pd_data = []
|
pd_data = []
|
||||||
fields_to_show.collect do |t|
|
fields_to_show.collect do |t|
|
||||||
|
@ -68,11 +68,12 @@ class Honor
|
||||||
|
|
||||||
{
|
{
|
||||||
"pd_datas" => pd_data,
|
"pd_datas" => pd_data,
|
||||||
"type-sort" => (p.honor_type.sort_position rescue 1000)
|
"type-sort" => (p.honor_type.sort_position.to_i rescue 1000),
|
||||||
|
"sort-index" => index
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
plugin_datas = plugin_datas.sort{|k,v| k["type-sort"] <=> v["type-sort"]}
|
plugin_datas = plugin_datas.sort_by{|pd| [pd["type-sort"], pd["sort-index"]]}
|
||||||
return [pd_title,plugin_datas]
|
return [pd_title,plugin_datas]
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue