diff --git a/app/models/experience.rb b/app/models/experience.rb index 0066fd9..ed5df74 100644 --- a/app/models/experience.rb +++ b/app/models/experience.rb @@ -54,7 +54,7 @@ class Experience "plugin_data_title" => I18n.t("personal_experience.#{t}") } end - plugin_datas = datas.sort_for_frontend.collect do |p| + plugin_datas = datas.sort_for_frontend.collect.with_index do |p,index| pd_data = [] fields_to_show.collect do |t| @@ -77,11 +77,12 @@ class Experience { "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 - 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] end