Permalink
Browse files

fix null values in custom monitors

  • Loading branch information...
laurencei committed Jun 11, 2018
1 parent c50bc25 commit 12de88be5f14be4544c6ad6b73ced88a588d6c67
Showing with 3 additions and 1 deletion.
  1. +3 −1 app/Tools/ChartTransformer.php
@@ -87,7 +87,9 @@ public function generateCustom($witness)
$history = CustomHistory::where('meta', $witness->getSafeName())->get()->groupBy(function($item) {
return $item->created_at->format('Y-m-d');
})->map(function ($row) {
return round($row->avg('value'), 2);
return round($row->filter(function($item) {
return (! is_null($item->value));
})->avg('value'), 2);
});
// Fill the array gaps - because the chart wont populate correctly without 0 values

0 comments on commit 12de88b

Please sign in to comment.