From a34784a15de67a7d26c818c54b468e4a8a7e0c67 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 24 Oct 2013 11:17:15 +0200 Subject: [PATCH] // Fixed chart for period before the store creation --- install-dev/data/theme.sql | 2 +- modules/dashtrends/dashtrends.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/install-dev/data/theme.sql b/install-dev/data/theme.sql index e393888dc..473042a67 100644 --- a/install-dev/data/theme.sql +++ b/install-dev/data/theme.sql @@ -125,7 +125,7 @@ UPDATE `PREFIX_hook_module` SET position = 5 WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockmyaccountfooter') AND id_hook = @id_hook; -UPDATE `PREFIX_hook_module` SET position = 3 +UPDATE `PREFIX_hook_module` SET position = 6 WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockcontactinfos') AND id_hook = @id_hook; diff --git a/modules/dashtrends/dashtrends.php b/modules/dashtrends/dashtrends.php index dcd76b0bc..7581ebaed 100644 --- a/modules/dashtrends/dashtrends.php +++ b/modules/dashtrends/dashtrends.php @@ -238,15 +238,18 @@ class Dashtrends extends Module $chart_data = array(); foreach (array_keys($this->dashboard_data) as $chart_key) { - $calibration = array_sum($this->dashboard_data[$chart_key]) / count($this->dashboard_data[$chart_key]); + $chart_data[$chart_key] = $chart_data_compare[$chart_key] = array(); + + if (!$count = count($this->dashboard_data[$chart_key])) + continue; + + $calibration = array_sum($this->dashboard_data[$chart_key]) / $count; - $chart_data[$chart_key] = array(); foreach ($this->dashboard_data[$chart_key] as $key => $value) $chart_data[$chart_key][] = array(1000 * $key, $calibration ? 100 * $value / $calibration : 0); if ($this->dashboard_data_compare) { - $chart_data_compare[$chart_key] = array(); foreach ($this->dashboard_data_compare[$chart_key] as $key => $value) $chart_data_compare[$chart_key][] = array(1000 * $key, $calibration ? 100 * $value / $calibration : 0); }