From a41a1fabf922b32ed3bdea55bac54e320dbd56ad Mon Sep 17 00:00:00 2001 From: Bomrah Harry Date: Wed, 18 Jul 2018 18:47:40 +0800 Subject: [PATCH] fix for expired jobs --- app/controllers/recruitments_controller.rb | 2 +- app/models/recruitment_job.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/recruitments_controller.rb b/app/controllers/recruitments_controller.rb index 1bb1355..ea69339 100644 --- a/app/controllers/recruitments_controller.rb +++ b/app/controllers/recruitments_controller.rb @@ -83,7 +83,7 @@ class RecruitmentsController < PseudoSessionController rjobs = RecruitmentJob.where(:post_type => type).not_filled end if !rjobs.nil? && !rjobs.is_a?(Array) - rjobs = rjobs.excluded_expired.desc(:created_at).page(OrbitHelper.page_number).per(OrbitHelper.page_data_count) + rjobs = rjobs.not_expired.desc(:created_at).page(OrbitHelper.page_number).per(OrbitHelper.page_data_count) total_pages = rjobs.total_pages else rjobs = [] diff --git a/app/models/recruitment_job.rb b/app/models/recruitment_job.rb index a090052..6cb2732 100644 --- a/app/models/recruitment_job.rb +++ b/app/models/recruitment_job.rb @@ -50,7 +50,7 @@ class RecruitmentJob scope :jobs, ->{where(:post_type => "type1")} scope :internships, ->{where(:post_type => "type2")} scope :exchanges, ->{where(:post_type => "type3")} - scope :excluded_expired, ->{any_of({:expiry_date.gte => Time.now}, {:expiry_date => nil})} + scope :not_expired, ->{any_of({:expiry_date.lte => Time.now}, {:expiry_date => nil})} def get_category RecruitmentCategory.find(self.category).job_category rescue ""