diff --git a/app/models/experience.rb b/app/models/experience.rb index 5e1dc9c..c6e6e3f 100644 --- a/app/models/experience.rb +++ b/app/models/experience.rb @@ -49,11 +49,19 @@ class Experience "duration" ] - pd_title = fields_to_show.collect do |t| - { - "plugin_data_title" => I18n.t("personal_experience.#{t}") - } + fields_to_remove = [] + + pd_title = [] + + fields_to_show.each do |t| + fields_to_remove << t if (datas.where(t.to_sym.ne => nil, t.to_sym.ne => "").count == 0 rescue false) + pd_title << { + "plugin_data_title" => I18n.t("personal_experience.#{t}") + } if !fields_to_remove.include?(t) end + + fields_to_show = fields_to_show - fields_to_remove + plugin_datas = datas.sort_for_frontend.collect.with_index do |p,index| pd_data = []