fix sql query for statistics gui feature

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2018-08-15 07:03:34 +00:00
parent 38c8b67ef9
commit 5a96b65ead

View File

@ -43,9 +43,9 @@ class ModelStatChart extends Model {
if($q) { $q .= ",?"; } else { $q = "?"; } if($q) { $q .= ",?"; } else { $q = "?"; }
} }
reset($auditdomains); reset($auditdomains);
$query = $this->db->query("select arrived-(arrived%$delta) as ts, count(*) as num from " . VIEW_MESSAGES . " where arrived > $range AND todomain IN ($q) $domains $grouping ORDER BY ts DESC limit $limit", $auditdomains); $query = $this->db->query("select ANY_VALUE(arrived-(arrived%$delta)) as ts, count(*) as num from " . VIEW_MESSAGES . " where arrived > $range AND todomain IN ($q) $domains $grouping ORDER BY ts DESC limit $limit", $auditdomains);
} else { } else {
$query = $this->db->query("select arrived-(arrived%$delta) as ts, count(*) as num from " . TABLE_META . " where arrived > $range $grouping ORDER BY ts DESC limit $limit"); $query = $this->db->query("select ANY_VALUE(arrived-(arrived%$delta)) as ts, count(*) as num from " . TABLE_META . " where arrived > $range $grouping ORDER BY ts DESC limit $limit");
} }
@ -114,7 +114,7 @@ class ModelStatChart extends Model {
$chart->setDataSet($dataSet); $chart->setDataSet($dataSet);
$chart->setTitle($title); $chart->setTitle($title);
$this->sendOutput($chart, $output); @$this->sendOutput($chart, $output);
} }