diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-12-05 12:49:52 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-12-05 12:49:52 +0000 |
commit | f838026f25f4b8ed6125707d7d2398554373da4b (patch) | |
tree | 1b687e3b79044c4ec3af0fa3b9af1415c88ca22d | |
parent | ff1fec27a51aa8c2f8ff6c74cc0a97d4739ba8ed (diff) | |
parent | 2dbf1d81c83fb64250828da8679a1d0557e8514c (diff) |
Merge branch 'issues/forcouncils/264-stop-csv-human-dates'
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Dashboard.pm | 19 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 10 |
3 files changed, 19 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7519434c4..0f950e974 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ - Council dashboard has date range for report generation #1885 - More JavaScript-enhanced `<select multiple>` elements #1589 - Council dashboard CSV export now has token based authentication #1911 + - And uses machine-readable dates. #1929 - Consolidate various admin summary statistics page. #1919. - 'Auto-response' flag on response templates is honoured for fetched Open311 updates. #1924 diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm index 834d9c8d6..5fe473c54 100644 --- a/perllib/FixMyStreet/App/Controller/Dashboard.pm +++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm @@ -344,12 +344,13 @@ sub export_as_csv { for my $comment ($report->comments) { my $problem_state = $comment->problem_state or next; + next unless $comment->state eq 'confirmed'; next if $problem_state eq 'confirmed'; - $hashref->{acknowledged_pp} //= $c->cobrand->prettify_dt( $comment->created ); - $hashref->{fixed_pp} //= $fixed_states->{ $problem_state } ? - $c->cobrand->prettify_dt( $comment->created ): undef; + $hashref->{acknowledged} //= $comment->confirmed; + $hashref->{fixed} //= $fixed_states->{ $problem_state } || $comment->mark_fixed ? + $comment->confirmed : undef; if ($closed_states->{ $problem_state }) { - $hashref->{closed_pp} = $c->cobrand->prettify_dt( $comment->created ); + $hashref->{closed} = $comment->confirmed; last; } } @@ -368,11 +369,11 @@ sub export_as_csv { 'detail', 'user_name_display', 'category', - 'created_pp', - 'confirmed_pp', - 'acknowledged_pp', - 'fixed_pp', - 'closed_pp', + 'created', + 'confirmed', + 'acknowledged', + 'fixed', + 'closed', 'state', 'latitude', 'longitude', 'postcode', diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 56601480d..3866532e9 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -871,6 +871,8 @@ sub as_hashref { my $self = shift; my $c = shift; + my $state_t = FixMyStreet::DB->resultset("State")->display($self->state); + return { id => $self->id, title => $self->title, @@ -881,12 +883,16 @@ sub as_hashref { postcode => $self->postcode, areas => $self->areas, state => $self->state, - state_t => _( $self->state ), + state_t => $state_t, used_map => $self->used_map, is_fixed => $self->fixed_states->{ $self->state } ? 1 : 0, photos => [ map { $_->{url} } @{$self->photos} ], meta => $self->confirmed ? $self->meta_line( $c ) : '', - confirmed_pp => $self->confirmed ? $c->cobrand->prettify_dt( $self->confirmed ): '', + ($self->confirmed ? ( + confirmed => $self->confirmed, + confirmed_pp => $c->cobrand->prettify_dt( $self->confirmed ), + ) : ()), + created => $self->created, created_pp => $c->cobrand->prettify_dt( $self->created ), }; } |