diff options
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 24 | ||||
-rw-r--r-- | templates/web/base/report/_item.html | 3 |
2 files changed, 16 insertions, 11 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index fac0fc7ef..f67e0b0f8 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -660,16 +660,20 @@ sub body { } } else { my $bodies = $problem->bodies; - $body = join( _(' and '), - map { - my $name = $_->name; - if ($c and FixMyStreet->config('AREA_LINKS_FROM_PROBLEMS')) { - '<a href="' . $_->url($c) . '">' . $name . '</a>'; - } else { - $name; - } - } values %$bodies - ); + my @body_names = sort map { + my $name = $_->name; + if ($c and FixMyStreet->config('AREA_LINKS_FROM_PROBLEMS')) { + '<a href="' . $_->url($c) . '">' . $name . '</a>'; + } else { + $name; + } + } values %$bodies; + if ( scalar @body_names > 2 ) { + $body = join( ', ', splice @body_names, 0, -1); + $body = join( ',' . _(' and '), ($body, $body_names[-1])); + } else { + $body = join( _(' and '), @body_names); + } } return $body; } diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html index 8179139ca..b1fa8fcad 100644 --- a/templates/web/base/report/_item.html +++ b/templates/web/base/report/_item.html @@ -66,7 +66,8 @@ [% IF include_sentinfo %] [% IF c.cobrand.is_council && !c.cobrand.owns_problem( problem ) %] (sent to [% problem.body %]) - [% ELSIF problem.bodies_str_ids.size > 1 %] [% loc('(sent to both)') %] + [% ELSIF problem.bodies_str_ids.size > 2 %] [% loc('(sent to all)') %] + [% ELSIF problem.bodies_str_ids.size == 2 %] [% loc('(sent to both)') %] [% ELSIF problem.bodies_str_ids.size == 0 %] [% loc('(not sent to council)') %] [% END %] [% END %] |