aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/DB')
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm8
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Nearby.pm9
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm9
3 files changed, 18 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index bee2e9bce..e55c26cd8 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -687,14 +687,14 @@ sub processed_summary_string {
}
if ($problem->can_display_external_id) {
if ($duration_clause) {
- $external_ref_clause = sprintf(_('council ref: %s'), $problem->external_id);
+ $external_ref_clause = '<strong>' . sprintf(_('Council ref:&nbsp;%s'), $problem->external_id) . '.</strong>';
} else {
- $external_ref_clause = sprintf(_('%s ref:&nbsp;%s'), $problem->external_body, $problem->external_id);
+ $external_ref_clause = '<strong>' . sprintf(_('%s ref:&nbsp;%s'), $problem->external_body, $problem->external_id) . '.</strong>';
}
}
if ($duration_clause and $external_ref_clause) {
- return "$duration_clause, $external_ref_clause"
- } else {
+ return "$duration_clause. $external_ref_clause"
+ } else {
return $duration_clause || $external_ref_clause
}
}
diff --git a/perllib/FixMyStreet/DB/ResultSet/Nearby.pm b/perllib/FixMyStreet/DB/ResultSet/Nearby.pm
index 91c44d5f4..a0ccb8a6d 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Nearby.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Nearby.pm
@@ -5,11 +5,15 @@ use strict;
use warnings;
sub nearby {
- my ( $rs, $c, $dist, $ids, $limit, $mid_lat, $mid_lon, $interval ) = @_;
+ my ( $rs, $c, $dist, $ids, $limit, $mid_lat, $mid_lon, $interval, $category, $states ) = @_;
+
+ unless ( $states ) {
+ $states = FixMyStreet::DB::Result::Problem->visible_states();
+ }
my $params = {
non_public => 0,
- state => [ FixMyStreet::DB::Result::Problem::visible_states() ],
+ state => [ keys %$states ],
};
$params->{'current_timestamp-lastupdate'} = { '<', \"'$interval'::interval" }
if $interval;
@@ -19,6 +23,7 @@ sub nearby {
%{ $c->cobrand->problems_clause },
%$params
} if $c->cobrand->problems_clause;
+ $params->{category} = $category if $category;
my $attrs = {
prefetch => 'problem',
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index 7a50a3146..7885c28b3 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -131,20 +131,25 @@ sub _recent {
# Problems around a location
sub around_map {
- my ( $rs, $min_lat, $max_lat, $min_lon, $max_lon, $interval, $limit ) = @_;
+ my ( $rs, $min_lat, $max_lat, $min_lon, $max_lon, $interval, $limit, $category, $states ) = @_;
my $attr = {
order_by => { -desc => 'created' },
};
$attr->{rows} = $limit if $limit;
+ unless ( $states ) {
+ $states = FixMyStreet::DB::Result::Problem->visible_states();
+ }
+
my $q = {
non_public => 0,
- state => [ FixMyStreet::DB::Result::Problem->visible_states() ],
+ state => [ keys %$states ],
latitude => { '>=', $min_lat, '<', $max_lat },
longitude => { '>=', $min_lon, '<', $max_lon },
};
$q->{'current_timestamp - lastupdate'} = { '<', \"'$interval'::interval" }
if $interval;
+ $q->{category} = $category if $category;
my @problems = mySociety::Locale::in_gb_locale { $rs->search( $q, $attr )->all };
return \@problems;