Skip to content

Commit

Permalink
improve cs
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Aug 30, 2023
1 parent 3b43e0d commit ddabcf7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Persistence/Array_/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public function aggregate(string $fx, string $field, bool $coalesce = false)

break;
case 'AVG':
$column = $coalesce ? $column : array_filter($column, static function ($value) {
return $value !== null;
});
if (!$coalesce) { // TODO add tests and verify against SQL
$column = array_filter($column, static fn ($v) => $v !== null);
}

$result = array_sum($column) / count($column);

Expand Down

0 comments on commit ddabcf7

Please sign in to comment.