diff --git a/app/helpers/admin/journal_papers_helper.rb b/app/helpers/admin/journal_papers_helper.rb index 0858313..79bb607 100644 --- a/app/helpers/admin/journal_papers_helper.rb +++ b/app/helpers/admin/journal_papers_helper.rb @@ -137,24 +137,22 @@ module Admin::JournalPapersHelper data["name"] = jl.title 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) - t = jl.journal_papers.where(:created_at.gte => d1, :created_at.lte => d2, :member_profile_id.in => mps).count rescue 0 + # d1 = DateTime.new(year,1,1,0,0) + # d2 = DateTime.new(year,12,31,23,59) + t = jl.journal_papers.where(:year => year, :member_profile_id.in => mps).count rescue 0 data["data"][year.to_s] = t end finaldata << data end data = {"name" => "N/A", "data" => {}} (year_start..year_end).each do |year| - d1 = DateTime.new(year,1,1,0,0) - d2 = DateTime.new(year,12,31,23,59) case type when "paper_type" - t = JournalPaper.where(:created_at.gte => d1, :created_at.lte => d2, :member_profile_id.in => mps, :journal_paper_type_id => nil).count rescue 0 + t = JournalPaper.where(:year => year, :member_profile_id.in => mps, :journal_paper_type_id => nil).count rescue 0 when "level_type" - t = JournalPaper.where(:created_at.gte => d1, :created_at.lte => d2, :member_profile_id.in => mps, :journal_level_ids => nil).count rescue 0 + t = JournalPaper.where(:year => year, :member_profile_id.in => mps, :journal_level_ids => nil).count rescue 0 when "author_type" - t = JournalPaper.where(:created_at.gte => d1, :created_at.lte => d2, :member_profile_id.in => mps, :journal_paper_author_type_ids => nil).count rescue 0 + t = JournalPaper.where(:year => year, :member_profile_id.in => mps, :journal_paper_author_type_ids => nil).count rescue 0 end data["data"][year.to_s] = t