diff --git a/app/helpers/admin/journal_papers_helper.rb b/app/helpers/admin/journal_papers_helper.rb index b9bd3bd..b447238 100644 --- a/app/helpers/admin/journal_papers_helper.rb +++ b/app/helpers/admin/journal_papers_helper.rb @@ -70,8 +70,8 @@ module Admin::JournalPapersHelper value = {"en" => val} when 3 begin - value["zh_tw"] = val - rescue + value["zh_tw"] = val + rescue value = {"zh_tw" => val} end jp.paper_title_translations = value @@ -80,7 +80,7 @@ module Admin::JournalPapersHelper when 5 begin value["zh_tw"] = val - rescue + rescue value = {"zh_tw" => val} end jp.journal_title_translations = value @@ -89,7 +89,7 @@ module Admin::JournalPapersHelper when 7 begin value["zh_tw"] = val - rescue + rescue value = {"zh_tw" => val} end jp.authors_translations = value @@ -99,40 +99,44 @@ module Admin::JournalPapersHelper jp.language = val when 10 jp.vol_no = val - when 11 + when 11 jp.issue_no = val - when 12 + when 12 + jp.form_to_start = val + when 13 + jp.form_to_end = val + when 14 jp.total_pages = val - when 13 + when 15 jls = JournalLevel.asc(:created_at).all.to_a ts = val.to_s.split(",") - ts.each do |t| + ts.each do |t| jp.journal_level_ids << jls[t.to_i].id if t.to_s.is_i? && t.to_i < jls.count end - when 14 + when 16 jpts = JournalPaperType.asc(:created_at).all.to_a jp.journal_paper_type = jpts[val.to_i] if val.to_s.is_i? && val.to_i < jpts.count - when 15 + when 17 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 if t.to_s.is_i? && t.to_i < jpas.count end - when 16 - jp.number_of_authors = val - when 17 - jp.isbn = val when 18 - jp.publication_date = val + jp.number_of_authors = val when 19 - jp.url = val - when 20 - jp.keywords = val + jp.isbn = val + when 20 + jp.publication_date = val when 21 - jp.abstract = val + jp.url = val when 22 - jp.note = val + jp.keywords = val when 23 + jp.abstract = val + when 24 + jp.note = val + when 25 jp.associated_project_translations = {"en" => val, "zh_tw" => val} end end @@ -148,7 +152,7 @@ module Admin::JournalPapersHelper d["name"] = role.title mps = role.member_profile_ids d1 = DateTime.new(year_start,1,1,0,0) - d2 = DateTime.new(year_end,12,31,23,59) + d2 = DateTime.new(year_end,12,31,23,59) d["data"] = JournalPaper.where(:publication_date.gte => d1, :publication_date.lte => d2, :member_profile_id.in => mps) rescue [] data << d end @@ -177,7 +181,7 @@ module Admin::JournalPapersHelper data["data"] = {} (year_start..year_end).each do |year| d1 = DateTime.new(year,1,1,0,0) - d2 = DateTime.new(year,12,31,23,59) + d2 = DateTime.new(year,12,31,23,59) t = jl.journal_papers.where(:publication_date.gte => d1, :publication_date.lte => d2, :member_profile_id.in => mps).count rescue 0 data["data"][year.to_s] = t end @@ -195,7 +199,7 @@ module Admin::JournalPapersHelper when "author_type" t = JournalPaper.where(:publication_date.gte => d1, :publication_date.lte => d2, :member_profile_id.in => mps, :journal_paper_author_type_ids => nil).count rescue 0 end - + data["data"][year.to_s] = t end finaldata << data