diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/TfL.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/Reporting.pm | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/TfL.pm b/perllib/FixMyStreet/Cobrand/TfL.pm index 9cf8910f9..b04841c39 100644 --- a/perllib/FixMyStreet/Cobrand/TfL.pm +++ b/perllib/FixMyStreet/Cobrand/TfL.pm @@ -254,6 +254,7 @@ sub dashboard_export_problems_add_columns { reassigned_at => "Reassigned at", reassigned_by => "Reassigned by", ); + $csv->splice_csv_column('fixed', action_scheduled => 'Action scheduled'); if ($csv->category) { my @contacts = $csv->body->contacts->search(undef, { order_by => [ 'category' ] } )->all; diff --git a/perllib/FixMyStreet/Reporting.pm b/perllib/FixMyStreet/Reporting.pm index 4573d78fc..efd12718c 100644 --- a/perllib/FixMyStreet/Reporting.pm +++ b/perllib/FixMyStreet/Reporting.pm @@ -58,6 +58,19 @@ sub modify_csv_header { ]); } +sub splice_csv_column { + my ($self, $before, $column, $header) = @_; + + for (my $i = 0; $i < @{$self->csv_columns}; $i++) { + my $col = $self->csv_columns->[$i]; + if ($col eq $before) { + splice @{$self->csv_columns}, $i, 0, $column; + splice @{$self->csv_headers}, $i, 0, $header; + last; + } + } +} + sub add_csv_columns { my $self = shift; for (my $i = 0; $i < @_; $i += 2) { @@ -255,6 +268,7 @@ sub generate_csv { next unless $comment->state eq 'confirmed'; next if $problem_state eq 'confirmed'; $hashref->{acknowledged} //= $comment->confirmed; + $hashref->{action_scheduled} //= $problem_state eq 'action scheduled' ? $comment->confirmed : undef; $hashref->{fixed} //= $fixed_states->{ $problem_state } || $comment->mark_fixed ? $comment->confirmed : undef; if ($closed_states->{ $problem_state }) { |