Stats per day

This commit is contained in:
Ruben 2017-03-31 12:33:55 +02:00
parent bdca46d286
commit 5c95018ddf

View file

@ -27,7 +27,7 @@ class StatsControllerProvider implements ControllerProviderInterface
$controllers->get('/', function (Application $app) { $controllers->get('/', function (Application $app) {
$gameRepo = $this->_eh->getEm()->getRepository(Models\Game::class); $gameRepo = $this->_eh->getEm()->getRepository(Models\Game::class);
$stats = [ $stats = [
'new_games' => [], 'new_games' => [],
'new_users' => [], 'new_users' => [],
@ -35,7 +35,7 @@ class StatsControllerProvider implements ControllerProviderInterface
for ($i=0; $i < 14; $i++) { for ($i=0; $i < 14; $i++) {
$day = date('Y-m-d',strtotime("-$i days")); $day = date('Y-m-d',strtotime("-$i days"));
$stats['new_games'] = $gameRepo->getCreatedCountOnDate($day); $stats['new_games'][$day] = $gameRepo->getCreatedCountOnDate($day);
} }
return $app['serializer']->serialize($stats, 'json'); return $app['serializer']->serialize($stats, 'json');
}); });