aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-04-26 09:50:29 +0100
committerMatthew Somerville <matthew@mysociety.org>2013-04-26 09:50:29 +0100
commit61e130783830050ac35093ad49c5fb2c75f12257 (patch)
treea85d249f28de62c1126ca47f3b4543fea50acdff
parenta3c652242ba95fa7c952cac1b836b154116db690 (diff)
Send email to Zurich DM when report in planned state after more than six days.
-rwxr-xr-xbin/zurich-overdue-alert5
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm8
2 files changed, 7 insertions, 6 deletions
diff --git a/bin/zurich-overdue-alert b/bin/zurich-overdue-alert
index 3ba8b9163..4a507c481 100755
--- a/bin/zurich-overdue-alert
+++ b/bin/zurich-overdue-alert
@@ -24,14 +24,15 @@ my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('zurich')->new();
my %bodies = map { $_->id => $_ } FixMyStreet::App->model("DB::Body")->all;
loop_through( 'alert-moderation-overdue.txt', 0, 1, [ 'unconfirmed', 'confirmed' ] );
-loop_through( 'alert-overdue.txt', 1, 5, 'in progress' );
+loop_through( 'alert-overdue.txt', 1, 6, 'in progress' );
+loop_through( 'alert-overdue.txt', 0, 6, 'planned' );
sub loop_through {
my ( $template, $include_parent, $days, $states ) = @_;
my $reports = FixMyStreet::App->model("DB::Problem")->search( {
state => $states,
- whensent => { '<', FixMyStreet::Cobrand::Zurich::sub_days( $now, $days ) },
+ created => { '<', FixMyStreet::Cobrand::Zurich::sub_days( $now, $days ) },
bodies_str => { '!=', undef },
} );
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index 5c873ceb5..d69fdebd2 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -168,16 +168,16 @@ sub sub_days {
sub overdue {
my ( $self, $problem ) = @_;
- my $w = $problem->whensent;
+ my $w = $problem->created;
return 0 unless $w;
if ( $problem->state eq 'unconfirmed' || $problem->state eq 'confirmed' ) {
# One working day
$w = add_days( $w, 1 );
return $w < DateTime->now() ? 1 : 0;
- } elsif ( $problem->state eq 'in progress' ) {
- # Five working days
- $w = add_days( $w, 5 );
+ } elsif ( $problem->state eq 'in progress' || $problem->state eq 'planned' ) {
+ # Six working days from creation
+ $w = add_days( $w, 6 );
return $w < DateTime->now() ? 1 : 0;
} else {
return 0;