forked from saurabh/personal-journal
changed analysis year to publication date
This commit is contained in:
parent
0fdc2d554d
commit
ebfaf2df79
|
@ -137,22 +137,24 @@ module Admin::JournalPapersHelper
|
||||||
data["name"] = jl.title
|
data["name"] = jl.title
|
||||||
data["data"] = {}
|
data["data"] = {}
|
||||||
(year_start..year_end).each do |year|
|
(year_start..year_end).each do |year|
|
||||||
# d1 = DateTime.new(year,1,1,0,0)
|
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(:year => year, :member_profile_id.in => mps).count rescue 0
|
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
|
data["data"][year.to_s] = t
|
||||||
end
|
end
|
||||||
finaldata << data
|
finaldata << data
|
||||||
end
|
end
|
||||||
data = {"name" => "N/A", "data" => {}}
|
data = {"name" => "N/A", "data" => {}}
|
||||||
(year_start..year_end).each do |year|
|
(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
|
case type
|
||||||
when "paper_type"
|
when "paper_type"
|
||||||
t = JournalPaper.where(:year => year, :member_profile_id.in => mps, :journal_paper_type_id => nil).count rescue 0
|
t = JournalPaper.where(:publication_date.gte => d1, :publication_date.lte => d2, :member_profile_id.in => mps, :journal_paper_type_id => nil).count rescue 0
|
||||||
when "level_type"
|
when "level_type"
|
||||||
t = JournalPaper.where(:year => year, :member_profile_id.in => mps, :journal_level_ids => nil).count rescue 0
|
t = JournalPaper.where(:publication_date.gte => d1, :publication_date.lte => d2, :member_profile_id.in => mps, :journal_level_ids => nil).count rescue 0
|
||||||
when "author_type"
|
when "author_type"
|
||||||
t = JournalPaper.where(:year => year, :member_profile_id.in => mps, :journal_paper_author_type_ids => nil).count rescue 0
|
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
|
end
|
||||||
|
|
||||||
data["data"][year.to_s] = t
|
data["data"][year.to_s] = t
|
||||||
|
|
Loading…
Reference in New Issue