diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-01-04 10:07:01 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-01-04 10:07:01 +0000 |
commit | a25c9af807346f917434f039afc6b1fdf007d22a (patch) | |
tree | fc2896ee235a66534ebf850e2f8da38c2309fee2 | |
parent | 6c4dfdb0048ed33384e0582164b5d8f4b51e752e (diff) |
Fix warning due to use of confirmed column on Zurich when not all will have that set.
-rwxr-xr-x | bin/update-all-reports | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/update-all-reports b/bin/update-all-reports index e9edae0af..2ede68fe0 100755 --- a/bin/update-all-reports +++ b/bin/update-all-reports @@ -18,6 +18,13 @@ use List::MoreUtils qw(zip); my $fourweeks = 4*7*24*60*60; +# Age problems from when they're confirmed, except on Zurich +# where they appear as soon as they're created. +my $age_column = 'confirmed'; +if ( FixMyStreet->config('BASE_URL') =~ /zurich/ ) { + $age_column = 'created'; +} + my $problems = FixMyStreet::App->model("DB::Problem")->search( { state => [ FixMyStreet::DB::Result::Problem->visible_states() ], @@ -26,7 +33,7 @@ my $problems = FixMyStreet::App->model("DB::Problem")->search( columns => [ 'id', 'bodies_str', 'state', 'areas', { duration => { extract => "epoch from current_timestamp-lastupdate" } }, - { age => { extract => "epoch from current_timestamp-confirmed" } }, + { age => { extract => "epoch from current_timestamp-$age_column" } }, ] } ); |