Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix job alert overlap #7355

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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