fix error

This commit is contained in:
邱博亞 2021-12-07 10:19:26 +08:00
parent 74776dce36
commit fa41d7c061
1 changed files with 5 additions and 22 deletions

View File

@ -52,45 +52,28 @@ module Admin::PersonalProjectsHelper
project = Project.new project = Project.new
row.cells.each_with_index do |cell,index| row.cells.each_with_index do |cell,index|
next if index < 2 next if index < 2
next if cell.nil? val = cell.value rescue nil
val = cell.value
next if val.nil? || val == ""
case index case index
when 2 when 2
value = {"en" => val} value = {"en" => val}
when 3 when 3
begin value["zh_tw"] = val
value["zh_tw"] = val
rescue
value = {"zh_tw" => val}
end end
project.project_title_translations = value project.project_title_translations = value
when 4 when 4
value = {"en" => val} value = {"en" => val}
when 5 when 5
begin value["zh_tw"] = val
value["zh_tw"] = val
rescue
value = {"zh_tw" => val}
end
project.job_title_translations = value project.job_title_translations = value
when 6 when 6
value = {"en" => val} value = {"en" => val}
when 7 when 7
begin value["zh_tw"] = val
value["zh_tw"] = val
rescue
value = {"zh_tw" => val}
end
project.participator_translations = value project.participator_translations = value
when 8 when 8
value = {"en" => val} value = {"en" => val}
when 9 when 9
begin value["zh_tw"] = val
value["zh_tw"] = val
rescue
value = {"zh_tw" => val}
end
project.unit_translations = value project.unit_translations = value
when 10 when 10
project.year = val project.year = val