diff options
Diffstat (limited to 'bin/zurich/overdue-alert')
-rwxr-xr-x | bin/zurich/overdue-alert | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/bin/zurich/overdue-alert b/bin/zurich/overdue-alert index 03845dddb..0473208c5 100755 --- a/bin/zurich/overdue-alert +++ b/bin/zurich/overdue-alert @@ -19,7 +19,8 @@ BEGIN { use DateTime; use CronFns; -use FixMyStreet::App; +use FixMyStreet::Cobrand; +use FixMyStreet::DB; use FixMyStreet::Email; my ($verbose, $nomail) = CronFns::options(); @@ -29,7 +30,7 @@ my $now = DateTime->now(); exit if FixMyStreet::Cobrand::Zurich::is_public_holiday($now) or FixMyStreet::Cobrand::Zurich::is_weekend($now); my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('zurich')->new(); -my %bodies = map { $_->id => $_ } FixMyStreet::App->model("DB::Body")->all; +my %bodies = map { $_->id => $_ } FixMyStreet::DB->resultset("Body")->all; loop_through( 'alert-moderation-overdue.txt', 0, 1, [ 'unconfirmed' ] ); loop_through( 'alert-overdue.txt', 1, 6, 'in progress' ); @@ -37,10 +38,10 @@ loop_through( 'alert-overdue.txt', 0, 6, ['confirmed', 'planned'] ); sub loop_through { my ( $template, $include_parent, $days, $states ) = @_; - my $dtf = FixMyStreet::App->model("DB")->storage->datetime_parser; + my $dtf = FixMyStreet::DB->storage->datetime_parser; my $date_threshold = $dtf->format_datetime(FixMyStreet::Cobrand::Zurich::sub_days( $now, $days )); - my $reports = FixMyStreet::App->model("DB::Problem")->search( { + my $reports = FixMyStreet::DB->resultset("Problem")->search( { state => $states, created => { '<', $date_threshold }, bodies_str => { '!=', undef }, @@ -78,7 +79,7 @@ sub send_alert { } FixMyStreet::Email::send_cron( - $schema, + FixMyStreet::DB->storage->schema, { _template_ => $template, _parameters_ => $h, |