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

Job alerts overlap testing #7370

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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 config/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ queue_applications_received:
queue: default

queue_daily_alerts:
cron: '0 15 * * *'
cron: '30 08 * * *'
class: 'SendDailyAlertEmailJob'
queue: default

Expand Down
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
2 changes: 1 addition & 1 deletion terraform/workspace-variables/review_app_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BIGQUERY_DATASET: staging_dataset
DFE_SIGN_IN_REGISTRATION_URL: https://test-profile.signin.education.gov.uk/register
DISABLE_DATABASE_ENVIRONMENT_CHECK: 1
DISABLE_EMAILS: false
DISABLE_EXPENSIVE_JOBS: true
DISABLE_EXPENSIVE_JOBS: false
ENFORCE_LOCAL_AUTHORITY_ALLOWLIST: false
RAILS_ENV: production
RAILS_LOG_TO_STDOUT: true
Expand Down
Loading