small fix for types and stuff

This commit is contained in:
Harry Bomrah 2015-12-11 19:36:41 +08:00
parent b4011a8ada
commit e883a9cae5
2 changed files with 6 additions and 6 deletions

View File

@ -80,16 +80,16 @@ module Admin::JournalPapersHelper
when 12 when 12
jp.total_pages = val jp.total_pages = val
when 13 when 13
jls = JournalLevel.all.to_a jls = JournalLevel.asc(:created_at).all.to_a
ts = val.to_s.split(",") ts = val.to_s.split(",")
ts.each do |t| ts.each do |t|
jp.journal_level_ids << jls[t.to_i].id jp.journal_level_ids << jls[t.to_i].id
end end
when 14 when 14
jpts = JournalPaperType.all.to_a jpts = JournalPaperType.asc(:created_at).all.to_a
jp.journal_paper_type = jpts[val.to_i] jp.journal_paper_type = jpts[val.to_i]
when 15 when 15
jpas = JournalPaperAuthorType.all.to_a jpas = JournalPaperAuthorType.asc(:created_at).all.to_a
ts = val.to_s.split(",") ts = val.to_s.split(",")
ts.each do |t| 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

View File

@ -60,7 +60,7 @@ wb.add_worksheet(name: "Journal Paper") do |sheet|
row1 << "checkbox" row1 << "checkbox"
t = "" t = ""
keys = [] keys = []
JournalLevel.each_with_index do |jl,i| JournalLevel.asc(:created_at).each_with_index do |jl,i|
t = t + "#{i}" + " -> " + jl.title + ", " t = t + "#{i}" + " -> " + jl.title + ", "
end end
if JournalLevel.count > 0 if JournalLevel.count > 0
@ -74,7 +74,7 @@ wb.add_worksheet(name: "Journal Paper") do |sheet|
row1 << "select" row1 << "select"
t = "" t = ""
keys = [] keys = []
JournalPaperType.each_with_index do |jl,i| JournalPaperType.asc(:created_at).each_with_index do |jl,i|
t = t + "#{i}" + " -> " + jl.title + ", " t = t + "#{i}" + " -> " + jl.title + ", "
end end
if JournalPaperType.count > 0 if JournalPaperType.count > 0
@ -88,7 +88,7 @@ wb.add_worksheet(name: "Journal Paper") do |sheet|
row1 << "checkbox" row1 << "checkbox"
t = "" t = ""
keys = [] keys = []
JournalPaperAuthorType.each_with_index do |jl,i| JournalPaperAuthorType.asc(:created_at).each_with_index do |jl,i|
t = t + "#{i}" + " -> " + jl.title + ", " t = t + "#{i}" + " -> " + jl.title + ", "
end end
if JournalPaperAuthorType.count > 0 if JournalPaperAuthorType.count > 0