diff --git a/app/jobs/alert_email/base.rb b/app/jobs/alert_email/base.rb index b7e3cb9253..7d64d9427e 100644 --- a/app/jobs/alert_email/base.rb +++ b/app/jobs/alert_email/base.rb @@ -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 diff --git a/app/jobs/send_daily_alert_email_job.rb b/app/jobs/send_daily_alert_email_job.rb index 62f81465e8..673a4ce6e1 100644 --- a/app/jobs/send_daily_alert_email_job.rb +++ b/app/jobs/send_daily_alert_email_job.rb @@ -6,6 +6,6 @@ def subscriptions end def from_date - Time.zone.yesterday + 2.days.ago.to_date end end diff --git a/app/jobs/send_weekly_alert_email_job.rb b/app/jobs/send_weekly_alert_email_job.rb index 98cdf2d326..0ccc26570f 100644 --- a/app/jobs/send_weekly_alert_email_job.rb +++ b/app/jobs/send_weekly_alert_email_job.rb @@ -6,6 +6,6 @@ def subscriptions end def from_date - 1.week.ago.to_date + 8.days.ago.to_date end end diff --git a/config/schedule.yml b/config/schedule.yml index 263a632ecc..7426fceb04 100644 --- a/config/schedule.yml +++ b/config/schedule.yml @@ -51,7 +51,7 @@ queue_applications_received: queue: default queue_daily_alerts: - cron: '0 15 * * *' + cron: '30 08 * * *' class: 'SendDailyAlertEmailJob' queue: default diff --git a/spec/jobs/send_daily_alert_email_job_spec.rb b/spec/jobs/send_daily_alert_email_job_spec.rb index 86db8c064e..4d245a22d6 100644 --- a/spec/jobs/send_daily_alert_email_job_spec.rb +++ b/spec/jobs/send_daily_alert_email_job_spec.rb @@ -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 diff --git a/spec/jobs/send_weekly_alert_email_job_spec.rb b/spec/jobs/send_weekly_alert_email_job_spec.rb index 5b576e473e..1aef67e624 100644 --- a/spec/jobs/send_weekly_alert_email_job_spec.rb +++ b/spec/jobs/send_weekly_alert_email_job_spec.rb @@ -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 diff --git a/terraform/workspace-variables/review_app_env.yml b/terraform/workspace-variables/review_app_env.yml index 158be032a6..7d3ee64f74 100644 --- a/terraform/workspace-variables/review_app_env.yml +++ b/terraform/workspace-variables/review_app_env.yml @@ -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