small fix for charts

This commit is contained in:
Harry Bomrah 2018-01-18 02:32:24 +08:00
parent 05a7c8ee06
commit 04b2af9e20
1 changed files with 15 additions and 3 deletions

View File

@ -15,20 +15,32 @@ class Admin::RecruitmentsController < OrbitAdminController
case params[:type]
when "posting"
@startdt = DateTime.parse("#{year}/#{month}")
enddt = DateTime.parse("#{year}/#{month.to_i + 1}")
if month.to_i < 12
enddt = DateTime.parse("#{year}/#{month.to_i + 1}")
else
enddt = DateTime.parse("#{year.to_i + 1}/1")
end
@data = {}
@data[t("recruitment.post_t.type1")] = RecruitmentJob.jobs.where(:created_at.gte => @startdt, :created_at.lt => enddt).count
@data[t("recruitment.post_t.type2")] = RecruitmentJob.internships.where(:created_at.gte => @startdt, :created_at.lt => enddt).count
@data[t("recruitment.post_t.type3")] = RecruitmentJob.exchanges.where(:created_at.gte => @startdt, :created_at.lt => enddt).count
when "registration"
@startdt = DateTime.parse("#{year}/#{month}")
enddt = DateTime.parse("#{year}/#{month.to_i + 1}")
if month.to_i < 12
enddt = DateTime.parse("#{year}/#{month.to_i + 1}")
else
enddt = DateTime.parse("#{year.to_i + 1}/1")
end
@data = {}
@data[t("recruitment.user_type.type1")] = RecruitProfile.employees.where(:created_at.gte => @startdt, :created_at.lt => enddt).count
@data[t("recruitment.user_type.type2")] = RecruitProfile.employers.where(:created_at.gte => @startdt, :created_at.lt => enddt).count
when "filled"
@startdt = DateTime.parse("#{year}/#{month}")
enddt = DateTime.parse("#{year}/#{month.to_i + 1}")
if month.to_i < 12
enddt = DateTime.parse("#{year}/#{month.to_i + 1}")
else
enddt = DateTime.parse("#{year.to_i + 1}/1")
end
@data = {}
@data[t("recruitment.post_t.type1")] = RecruitmentJob.jobs.filled.where(:created_at.gte => @startdt, :created_at.lt => enddt).count
@data[t("recruitment.post_t.type2")] = RecruitmentJob.internships.filled.where(:created_at.gte => @startdt, :created_at.lt => enddt).count