Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Improved fix of volkszaehler#923 "aggregate fails due to division by …
Browse files Browse the repository at this point in the history
…zero"

I improved the solution due to the comment of andig.
  • Loading branch information
mh-er authored Apr 27, 2023
1 parent 0f67a55 commit cdc9a63
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/Util/Aggregation.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,7 @@ protected function aggregateChannel($channel_id, $interpreter, $mode, $level, $p
// since last aggregation only
array_push($sqlParameters, $type, $channel_id);
$intialTimestamp =
'UNIX_TIMESTAMP(DATE_ADD(' .
'FROM_UNIXTIME(MAX(timestamp) / 1000, "%Y-%m-%d %H:%i:%s"), ' .
'INTERVAL 0 ' . $level . ')) * 1000 ' .
'MAX(timestamp) ' .
'FROM aggregate ' .
'WHERE type = ? AND aggregate.channel_id = ?';
} elseif ($period) {
Expand Down

0 comments on commit cdc9a63

Please sign in to comment.