aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand/Default.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/Default.pm')
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm28
1 files changed, 20 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index b002dd7f2..208ac6643 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -11,9 +11,9 @@ use mySociety::MaPit;
=head2 new
my $cobrand = $class->new;
- my $cobrand = $class->new( { request => $c->req } );
+ my $cobrand = $class->new( { c => $c } );
-Create a new cobrand object, optionally setting the web request.
+Create a new cobrand object, optionally setting the context.
You probably shouldn't need to do this and should get the cobrand object via a
method in L<FixMyStreet::Cobrand> instead.
@@ -69,6 +69,18 @@ sub path_to_web_templates {
return FixMyStreet->path_to( 'templates/web', $self->moniker );
}
+=head1 problems
+
+Returns a ResultSet of Problems, restricted to a subset if we're on a cobrand
+that only wants some of the data.
+
+=cut
+
+sub problems {
+ my $self = shift;
+ return $self->{c}->model('DB::Problem');
+}
+
=head1 site_restriction
Return a site restriction clause and a site key if the cobrand uses a subset of
@@ -208,8 +220,8 @@ Return recent problems on the site.
=cut
sub recent {
- my $self = shift;
- return Problems::recent(@_);
+ my ( $self ) = @_;
+ return $self->problems->recent();
}
=item shorten_recency_if_new_greater_than_fixed
@@ -231,18 +243,18 @@ can then format.
=cut
sub front_stats_data {
- my $self = shift;
+ my ( $self ) = @_;
my $recency = '1 week';
my $shorter_recency = '3 days';
- my $fixed = Problems::recent_fixed();
+ my $fixed = $self->problems->recent_fixed();
my $updates = Problems::number_comments();
- my $new = Problems::recent_new($recency);
+ my $new = $self->problems->recent_new( $recency );
if ( $new > $fixed && $self->shorten_recency_if_new_greater_than_fixed ) {
$recency = $shorter_recency;
- $new = Problems::recent_new($recency);
+ $new = $self->problems->recent_new( $recency );
}
my $stats = {