Skip to content

Commit

Permalink
fix job alert overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
starswan committed Dec 19, 2024
1 parent de07007 commit 34d8432
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/jobs/alert_email/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ def perform
end

def vacancies_for_subscription(subscription)
subscription.vacancies_for_range(from_date, Date.current)
subscription.vacancies_for_range(from_date, Date.yesterday)
end
end
2 changes: 1 addition & 1 deletion app/jobs/send_daily_alert_email_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ def subscriptions
end

def from_date
Time.zone.yesterday
2.days.ago.to_date
end
end
2 changes: 1 addition & 1 deletion app/jobs/send_weekly_alert_email_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ def subscriptions
end

def from_date
1.week.ago.to_date
8.days.ago.to_date
end
end
2 changes: 1 addition & 1 deletion spec/jobs/send_daily_alert_email_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
let(:job) { described_class.new }

it "gets vacancies in the last day" do
expect(subscription).to receive(:vacancies_for_range).with(Time.zone.yesterday, Date.current) { Vacancy.none }
expect(subscription).to receive(:vacancies_for_range).with(2.days.ago.to_date, Date.yesterday) { Vacancy.none }
job.vacancies_for_subscription(subscription)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/send_weekly_alert_email_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
let(:job) { described_class.new }

it "gets vacancies in the last week" do
expect(subscription).to receive(:vacancies_for_range).with(1.week.ago.to_date, Date.current) { Vacancy.none }
expect(subscription).to receive(:vacancies_for_range).with(8.days.ago.to_date, Date.yesterday) { Vacancy.none }
job.vacancies_for_subscription(subscription)
end
end
Expand Down

0 comments on commit 34d8432

Please sign in to comment.