#3: Fixed some issues with the statistics combined graph and file size pie graph

This commit is contained in:
Andy Heathershaw 2017-09-12 20:36:39 +01:00
parent 15492f5ad7
commit 365ea689ef
1 changed files with 5 additions and 2 deletions

View File

@ -120,7 +120,7 @@ class StatisticsController extends Controller
]; ];
$data = [0, 0, 0, 0]; $data = [0, 0, 0, 0];
$stats = DB::table('photos')->whereIn('album_id', DbHelper::getAlbumIDsForCurrentUser()); $stats = DB::table('photos')->whereIn('album_id', DbHelper::getAlbumIDsForCurrentUser())->orderBy('id');
$stats->chunk(100, function($photos) use (&$data) $stats->chunk(100, function($photos) use (&$data)
{ {
foreach ($photos as $photo) foreach ($photos as $photo)
@ -192,9 +192,12 @@ class StatisticsController extends Controller
$data[1]['values'][] = $photoCountUploaded; $data[1]['values'][] = $photoCountUploaded;
} }
$data[0]['values'] = array_reverse($data[0]['values']);
$data[1]['values'] = array_reverse($data[1]['values']);
return response()->json([ return response()->json([
'labels' => array_reverse($labels), 'labels' => array_reverse($labels),
'data' => array_reverse($data) 'data' => $data
]); ]);
} }