small fix for import of journal

This commit is contained in:
Harry Bomrah 2015-12-11 20:10:35 +08:00
parent e883a9cae5
commit 4af43b8905
2 changed files with 4 additions and 7 deletions

View File

@ -83,16 +83,16 @@ module Admin::JournalPapersHelper
jls = JournalLevel.asc(:created_at).all.to_a
ts = val.to_s.split(",")
ts.each do |t|
jp.journal_level_ids << jls[t.to_i].id
jp.journal_level_ids << jls[t.to_i].id if t.is_i? && t.to_i < jls.count
end
when 14
jpts = JournalPaperType.asc(:created_at).all.to_a
jp.journal_paper_type = jpts[val.to_i]
jp.journal_paper_type = jpts[val.to_i] if val.is_i? && val.to_i < jpts.count
when 15
jpas = JournalPaperAuthorType.asc(:created_at).all.to_a
ts = val.to_s.split(",")
ts.each do |t|
jp.journal_paper_author_type_ids << jpas[t.to_i].id
jp.journal_paper_author_type_ids << jpas[t.to_i].id if t.is_i? && t.to_i < jpas.count
end
when 16
jp.number_of_authors = val

View File

@ -59,7 +59,6 @@ wb.add_worksheet(name: "Journal Paper") do |sheet|
row << t("personal_journal.level_type")
row1 << "checkbox"
t = ""
keys = []
JournalLevel.asc(:created_at).each_with_index do |jl,i|
t = t + "#{i}" + " -> " + jl.title + ", "
end
@ -73,7 +72,6 @@ wb.add_worksheet(name: "Journal Paper") do |sheet|
row << t("personal_journal.paper_type")
row1 << "select"
t = ""
keys = []
JournalPaperType.asc(:created_at).each_with_index do |jl,i|
t = t + "#{i}" + " -> " + jl.title + ", "
end
@ -87,7 +85,6 @@ wb.add_worksheet(name: "Journal Paper") do |sheet|
row << t("personal_journal.author_type")
row1 << "checkbox"
t = ""
keys = []
JournalPaperAuthorType.asc(:created_at).each_with_index do |jl,i|
t = t + "#{i}" + " -> " + jl.title + ", "
end