Skip to content

Commit

Permalink
Implement min and max for generic graph
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 7, 2020
1 parent d9fda71 commit 0f1a8a3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions htdocs/core/customreports.php
Expand Up @@ -351,6 +351,14 @@
$tmpval = preg_replace('/\-average$/', '', $val);
$sql .= 'AVG('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', ';
}
elseif (preg_match('/\-min$/', $val)) {
$tmpval = preg_replace('/\-min$/', '', $val);
$sql .= 'MIN('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', ';
}
elseif (preg_match('/\-max$/', $val)) {
$tmpval = preg_replace('/\-max$/', '', $val);
$sql .= 'MAX('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', ';
}
}
$sql = preg_replace('/,\s*$/', '', $sql);
$sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
Expand Down

0 comments on commit 0f1a8a3

Please sign in to comment.