Fix wrong data in statstics when exporting data

This commit is contained in:
Shreesh Arora
2023-10-27 18:32:48 +05:30
parent ce93a9826f
commit 1b851d2064
9 changed files with 80 additions and 26 deletions

View File

@@ -102,7 +102,7 @@ abstract class ModuleGraphCore extends Module
$this->_values[$j][$i] = 0;
}
}
$this->_legend[$i] = ($i % 2) ? '' : sprintf('%02d', $i);
$this->_legend[$i] = sprintf('%02d', $i);
}
}
if (is_callable(array($this, 'setMonthValues'))) {
@@ -195,15 +195,15 @@ abstract class ModuleGraphCore extends Module
if (count($this->_legend)) {
$total = 0;
if ($datas['type'] == 'pie') {
foreach ($this->_legend as $key => $legend) {
// foreach ($this->_legend as $key => $legend) {
for ($i = 0, $total_main = (is_array($this->_titles['main']) ? count($this->_values) : 1); $i < $total_main; ++$i) {
$total += (is_array($this->_values[$i]) ? $this->_values[$i][$key] : $this->_values[$key]);
$total += (is_array($this->_values[$i]) ? $this->_values[$i][$key] : $this->_values[$i]);
}
}
// }
}
foreach ($this->_legend as $key => $legend) {
$this->_csv .= $legend.';';
for ($i = 0, $total_main = (is_array($this->_titles['main']) ? count($this->_values) : 1); $i < $total_main; ++$i) {
for ($i = 0, $total_main = (is_array($this->_titles['main']) ? (count($this->_titles['main']) - 1) : 1); $i < $total_main; ++$i) {
if (!isset($this->_values[$i]) || !is_array($this->_values[$i])) {
if (isset($this->_values[$key])) {
// We don't want strings to be divided. Example: product name