From 493c1a270b02bf1cd6030e56babefcca89a81595 Mon Sep 17 00:00:00 2001 From: Mark Longair Date: Mon, 19 Aug 2013 12:43:16 +0100 Subject: Refactor calculation of statistics Move the calculation of statistics on public bodies into the PublicBody model, so that there's less logic in the controller. --- public/javascripts/stats-graphs.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'public/javascripts/stats-graphs.js') diff --git a/public/javascripts/stats-graphs.js b/public/javascripts/stats-graphs.js index 9d9ac5b9d..73e19a6fc 100644 --- a/public/javascripts/stats-graphs.js +++ b/public/javascripts/stats-graphs.js @@ -13,6 +13,11 @@ $(document).ready(function() { graph_data, graph_div = $('#' + graph_id); + if (!graph_data.x_values) { + /* Then there's no data for this graph */ + return true; + } + graph_div.css('width', '700px'); graph_div.css('height', '400px'); -- cgit v1.2.3