aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-10-28 14:26:59 +0100
committerStruan Donald <struan@exo.org.uk>2011-10-28 14:26:59 +0100
commit34c5d208ef4c6372f1f2960882ffe77e5f250614 (patch)
tree6e1f22343ae00b5a99563d3d73c6cf7d5c280d38
parent5125b7f0cefaa18d5c230f12999856ab153d0c2e (diff)
add ability to have submission source stats on council reports page and use for reading cobrand
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm22
-rw-r--r--templates/web/default/reports/cobrand_stats.html0
-rwxr-xr-xtemplates/web/default/reports/council.html2
-rw-r--r--templates/web/reading/reports/cobrand_stats.html4
4 files changed, 21 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index 93af3393c..0a4ae4609 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -338,7 +338,7 @@ sub load_and_group_problems : Private {
$where,
{
columns => [
- 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title',
+ 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand',
{ duration => { extract => "epoch from current_timestamp-lastupdate" } },
{ age => { extract => "epoch from current_timestamp-confirmed" } },
],
@@ -349,11 +349,17 @@ sub load_and_group_problems : Private {
$c->stash->{pager} = $problems->pager;
$problems = $problems->cursor; # Raw DB cursor for speed
- my ( %fixed, %open, @pins );
+ my ( %fixed, %open, @pins, $total, $cobrand_total );
my $re_councils = join('|', keys %{$c->stash->{areas_info}});
- my @cols = ( 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', 'duration', 'age' );
+ my @cols = ( 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', 'duration', 'age' );
while ( my @problem = $problems->next ) {
my %problem = zip @cols, @problem;
+ $c->log->debug( $problem{'cobrand'} . ', cobrand is ' . $c->cobrand->moniker );
+ if ( $problem{'cobrand'} && $problem{'cobrand'} eq $c->cobrand->moniker ) {
+ $cobrand_total++;
+ } else {
+ $total++;
+ }
if ( !$problem{council} ) {
# Problem was not sent to any council, add to possible councils
$problem{councils} = 0;
@@ -372,10 +378,12 @@ sub load_and_group_problems : Private {
}
}
- $c->stash(
- fixed => \%fixed,
- open => \%open,
- pins => \@pins,
+ $c->stash(
+ fixed => \%fixed,
+ open => \%open,
+ pins => \@pins,
+ cobrand_count => $cobrand_total || 0,
+ total_count => $total || 0,
);
return 1;
diff --git a/templates/web/default/reports/cobrand_stats.html b/templates/web/default/reports/cobrand_stats.html
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/templates/web/default/reports/cobrand_stats.html
diff --git a/templates/web/default/reports/council.html b/templates/web/default/reports/council.html
index 0739e84e8..44f0040cb 100755
--- a/templates/web/default/reports/council.html
+++ b/templates/web/default/reports/council.html
@@ -75,6 +75,8 @@ Its area is now covered by <a href="/reports/Bedford">Bedford Borough Council</a
<h2>[% name %]</h2>
+[% INCLUDE 'reports/cobrand_stats.html' %]
+
[% IF c.cobrand.moniker == '' %]
<p class="promo">
FixMyStreet is now available for local council websites.
diff --git a/templates/web/reading/reports/cobrand_stats.html b/templates/web/reading/reports/cobrand_stats.html
new file mode 100644
index 000000000..becb724cf
--- /dev/null
+++ b/templates/web/reading/reports/cobrand_stats.html
@@ -0,0 +1,4 @@
+<ul>
+ <li>Reports submitted via <a href="[% uri_for('/') %]">reading.fixmystreet.com</a>: [% cobrand_count %]</li>
+ <li>Reports submitted via <a href="http://www.fixmystreet.com/">www.fixmystreet.com</a>: [% total_count %]</li>
+</ul>