forked from saurabh/personal-experience
sort fix
This commit is contained in:
parent
c70bafc599
commit
49ec846c38
|
@ -54,7 +54,7 @@ class Experience
|
||||||
"plugin_data_title" => I18n.t("personal_experience.#{t}")
|
"plugin_data_title" => I18n.t("personal_experience.#{t}")
|
||||||
}
|
}
|
||||||
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|
|
||||||
|
@ -77,11 +77,12 @@ class Experience
|
||||||
|
|
||||||
{
|
{
|
||||||
"pd_datas" => pd_data,
|
"pd_datas" => pd_data,
|
||||||
"type-sort" => (p.experience_type.sort_position rescue 1000)
|
"type-sort" => (p.experience_type.sort_position rescue 1000),
|
||||||
|
"sort-index" => index.to_s
|
||||||
}
|
}
|
||||||
|
|
||||||
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