Show real stats on home page

This commit is contained in:
Rohan Mitchell
2015-05-06 11:31:32 +10:00
parent e662aab004
commit 1ffba674b3
2 changed files with 19 additions and 18 deletions

View File

@@ -1,11 +1,14 @@
class HomeController < BaseController
layout 'darkswarm'
before_filter :load_active_distributors
def index
@num_hubs = Enterprise.is_hub.count
@num_producers = Enterprise.is_primary_producer.count
@num_users = Spree::User.joins(:orders).count('DISTINCT spree_users.*')
@num_orders = Spree::Order.complete.count
end
def about_us
end
end

View File

@@ -5,25 +5,23 @@
%p.text-big Thanks for making the Open Food Network possible. Our vision is a better food system, and we're proud of what we're achieving together.
%br
%br
// Todo: make these variables live from OFN data.
// Todo: investigate state / postcode / location stat. Easy / hard?
.stat1
%h4
%strong 4
states represented
.stat1
%h4
%strong 126
-# .stat1
-# %h4
-# %strong 44444
-# states represented
.stat2
%h4
%strong= number_with_delimiter @num_hubs
food shops
.stat3
%h4
%strong 345
%h4
%strong= number_with_delimiter @num_producers
food producers
.stat4
%h4
%strong 2,201
%h4
%strong= number_with_delimiter @num_users
happy food shoppers
.stat5
%h4
%strong 3,902
orders made
%h4
%strong= number_with_delimiter @num_orders
orders made