diff options
-rw-r--r-- | app/controllers/public_body_controller.rb | 4 | ||||
-rw-r--r-- | config/general.yml-example | 4 | ||||
-rw-r--r-- | lib/configuration.rb | 1 |
3 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index 2c8d83f6f..244fdfc92 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -152,7 +152,9 @@ class PublicBodyController < ApplicationController def statistics per_graph = 10 - minimum_requests = 1 + minimum_requests = AlaveteliConfiguration::minimum_requests_for_statistics + # Make sure minimum_requests is > 0 to avoid division-by-zero + minimum_requests = [minimum_requests, 1].max total_column = 'info_requests_count' graphs = [[total_column, diff --git a/config/general.yml-example b/config/general.yml-example index 0753af46b..e90674b0f 100644 --- a/config/general.yml-example +++ b/config/general.yml-example @@ -192,3 +192,7 @@ MTA_LOG_TYPE: "exim" # this will be included in the message people see when their request is # successful. DONATION_URL: "http://www.mysociety.org/donate/" + +# The page of statistics for public bodies will only consider public +# bodies that have had at least this number of requests: +MINIMUM_REQUESTS_FOR_STATISTICS: 50 diff --git a/lib/configuration.rb b/lib/configuration.rb index 03c4ac616..bf80f87e1 100644 --- a/lib/configuration.rb +++ b/lib/configuration.rb @@ -43,6 +43,7 @@ module AlaveteliConfiguration :INCOMING_EMAIL_PREFIX => '', :INCOMING_EMAIL_SECRET => 'dummysecret', :ISO_COUNTRY_CODE => 'GB', + :MINIMUM_REQUESTS_FOR_STATISTICS => 100, :MAX_REQUESTS_PER_USER_PER_DAY => '', :MTA_LOG_TYPE => 'exim', :NEW_RESPONSE_REMINDER_AFTER_DAYS => [3, 10, 24], |