diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-03-08 11:06:21 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-03-08 11:06:21 +0000 |
commit | e946a7b752ec93144262b01fddf73a835274cc42 (patch) | |
tree | f97757425eda54c47768a8b166ede7407b1ed7d1 | |
parent | ddc2fd59373c4210d6a9b1b9d41f487d5c4d0e72 (diff) |
Have total on EHA front page be all time.
-rw-r--r-- | perllib/FixMyStreet/Cobrand/EmptyHomes.pm | 16 | ||||
-rw-r--r-- | templates/web/default/front/stats.html | 4 | ||||
-rw-r--r-- | templates/web/emptyhomes/front/stats.html | 7 | ||||
-rw-r--r-- | web/cobrands/emptyhomes/css.css | 2 |
4 files changed, 24 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm index ef27d2c4e..99aec5ac1 100644 --- a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm +++ b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm @@ -119,6 +119,22 @@ sub process_extras { $extra->{address} = $value; } +sub front_stats_data { + my ( $self ) = @_; + my $key = "recent_new"; + my $result = Memcached::get($key); + unless ($result) { + $result = $self->problems->search( + { state => [ FixMyStreet::DB::Result::Problem->visible_states() ] } + )->count; + foreach my $v (values %{$self->old_site_stats}) { + $result += $v; + } + Memcached::set($key, $result, 3600); + } + return $result; +} + # A record of the number of reports from the Channel 4 site and other old data sub old_site_stats { return { diff --git a/templates/web/default/front/stats.html b/templates/web/default/front/stats.html index fc8b9e99a..5367f1118 100644 --- a/templates/web/default/front/stats.html +++ b/templates/web/default/front/stats.html @@ -36,12 +36,8 @@ <div id="front_stats"> <div>[% tprintf( new_text, stats.new ) | comma %]</div> - [% IF c.cobrand.moniker == 'emptyhomes' %] - <div><a href="/local/">Find latest local and national news</a></div> - [% ELSE %] <div>[% tprintf( fixed_text, stats.fixed ) | comma %]</div> [% IF c.cobrand.moniker != 'zurich' %] <div>[% tprintf( updates_text, stats.updates ) | comma %]</div> [% END %] - [% END %] </div> diff --git a/templates/web/emptyhomes/front/stats.html b/templates/web/emptyhomes/front/stats.html new file mode 100644 index 000000000..f6aacf859 --- /dev/null +++ b/templates/web/emptyhomes/front/stats.html @@ -0,0 +1,7 @@ +[% USE Comma %] +[% stats = c.cobrand.front_stats_data %] + +<div id="front_stats"> + <div>[% tprintf( loc("<big>%s</big> reports"), stats ) | comma %]</div> + <div><a href="/local/">[% loc('Find latest local and national news') %]</a></div> +</div> diff --git a/web/cobrands/emptyhomes/css.css b/web/cobrands/emptyhomes/css.css index b9d7342a0..595d11ac2 100644 --- a/web/cobrands/emptyhomes/css.css +++ b/web/cobrands/emptyhomes/css.css @@ -198,7 +198,7 @@ a:hover, a:active { vertical-align: middle; background-color: #80AE7D; color: #000000; - /*padding: 0.5em 0; */ + padding: 0.5em; width: 7em; } #mysociety #front_stats div a { |