Fix tests.

This commit is contained in:
James Cole
2016-12-23 15:52:12 +01:00
parent cde494d3ef
commit 0e11245cb4

View File

@@ -375,13 +375,16 @@ class CategoryReportController extends Controller
$currentStart->addDay(); $currentStart->addDay();
} }
// remove all empty entries to prevent cluttering: // remove all empty entries to prevent cluttering:
$newSet = [];
foreach ($chartData as $key => $entry) { foreach ($chartData as $key => $entry) {
if (array_sum($entry['entries']) == 0) { if (!array_sum($entry['entries']) == 0) {
unset($chartData[$key]); $newSet[$key] = $chartData[$key];
} }
} }
if (count($newSet) === 0) {
$data = $this->generator->multiSet($chartData); $newSet = $chartData;
}
$data = $this->generator->multiSet($newSet);
$cache->store($data); $cache->store($data);
return Response::json($data); return Response::json($data);