aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm26
-rw-r--r--templates/web/default/report/_main.html7
2 files changed, 31 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index ce7488703..4b8966aef 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -563,6 +563,32 @@ sub body {
}
# TODO Some/much of this could be moved to the template
+
+# either:
+# "sent to council 3 mins later"
+# "council ref: XYZ"
+# or
+# "sent to council 3 mins later, their ref: XYZ"
+#
+# Note: some silliness with pronouns and the adjacent comma mean this is
+# being presented as a single string rather than two
+sub processed_summary_string {
+ my ( $problem, $c ) = @_;
+ my ($duration_clause, $external_ref_clause);
+ if ($problem->whensent) {
+ $duration_clause = $problem->duration_string($c)
+ }
+ if ($problem->external_id) {
+ my $external_body = $duration_clause? _("their") : $problem->external_body;
+ $external_ref_clause = sprintf(_('%s ref: %s'), $external_body, $problem->external_id);
+ }
+ if ($duration_clause and $external_ref_clause) {
+ return "$duration_clause, $external_ref_clause"
+ } else {
+ return $duration_clause || $external_ref_clause
+ }
+}
+
sub duration_string {
my ( $problem, $c ) = @_;
my $body = $problem->body( $c );
diff --git a/templates/web/default/report/_main.html b/templates/web/default/report/_main.html
index 8cc1efec2..552be17e6 100644
--- a/templates/web/default/report/_main.html
+++ b/templates/web/default/report/_main.html
@@ -2,9 +2,12 @@
<p><em>[% problem.meta_line(c) | html %]
[% IF problem.council %]
- [% IF problem.whensent %]
- <small class="council_sent_info"><br>[% problem.duration_string(c) %]</small>
+ [% IF problem.whensent || problem.external_id %]
+ <small class="council_sent_info"><br>
+ [% problem.processed_summary_string(c) %]
+ </small>
[% END %]
+
[% ELSE %]
<br><small>[% loc('Not reported to council') %]</small>
[% END %]