diff options
author | Dave Arter <davea@mysociety.org> | 2016-08-30 15:48:17 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-09-08 13:44:52 +0100 |
commit | 7cc39bf875630ae5a2ad9b7245eac286cfaab59f (patch) | |
tree | 8308dbb077579261676497696115a67d7a377d4f | |
parent | a8a8d0eabe274f1492c3cb66479098056d901924 (diff) |
[Oxfordshire] Display confirmed reports as received by the Council
This introduces a new `is_council_with_case_management` flag for Cobrands, that,
when active, considers any report that's been confirmed as having been received
by the Council in question.
See mysociety/fixmystreetforcouncils#65
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Oxfordshire.pm | 5 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 7 | ||||
-rw-r--r-- | templates/web/base/report/_council_sent_info.html | 4 | ||||
-rw-r--r-- | templates/web/oxfordshire/report/_main_sent_info.html | 5 |
4 files changed, 17 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm index 30240f61e..f8079565d 100644 --- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm +++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm @@ -10,6 +10,11 @@ sub council_name { return 'Oxfordshire County Council'; } sub council_url { return 'oxfordshire'; } sub is_two_tier { return 1; } +sub is_council_with_case_management { + # XXX Change this to return 1 when OCC FMSfC goes live. + return FixMyStreet->config('STAGING_SITE'); +} + sub map_type { 'OSM' } sub base_url { diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 308fba71f..8236524d6 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -678,6 +678,13 @@ sub duration_string { } else { $body = $problem->body( $c ); } + if ( $c->cobrand->can('get_body_handler_for_problem') ) { + my $handler = $c->cobrand->get_body_handler_for_problem( $problem ); + if ( $handler->can('is_council_with_case_management') && $handler->is_council_with_case_management ) { + return sprintf(_('Received by %s moments later'), $body); + } + } + return unless $problem->whensent; return sprintf(_('Sent to %s %s later'), $body, Utils::prettify_duration($problem->whensent->epoch - $problem->confirmed->epoch, 'minute') ); diff --git a/templates/web/base/report/_council_sent_info.html b/templates/web/base/report/_council_sent_info.html index affc73414..dca74f994 100644 --- a/templates/web/base/report/_council_sent_info.html +++ b/templates/web/base/report/_council_sent_info.html @@ -1,6 +1,6 @@ -[% IF problem.whensent || problem.can_display_external_id %] +[% SET duration_clause = problem.duration_string(c) %] +[% IF duration_clause || problem.can_display_external_id %] <p class="council_sent_info"> - [% SET duration_clause = problem.duration_string(c) IF problem.whensent %] [%- IF problem.can_display_external_id %] [%- IF duration_clause %] [%- external_ref_clause = tprintf(loc('Council ref: %s'), problem.external_id) %] diff --git a/templates/web/oxfordshire/report/_main_sent_info.html b/templates/web/oxfordshire/report/_main_sent_info.html index c955a5fae..9865153d3 100644 --- a/templates/web/oxfordshire/report/_main_sent_info.html +++ b/templates/web/oxfordshire/report/_main_sent_info.html @@ -1,3 +1,4 @@ -[% IF problem.whensent %] - <p class="council_sent_info">[% problem.duration_string(c) %]</p> +[% SET duration_clause = problem.duration_string(c) %] +[% IF duration_clause %] + <p class="council_sent_info">[% duration_clause %]</p> [% END %] |