1
0
Fork 0
mirror of synced 2024-06-14 00:34:51 +12:00

fix(project): set limit to retrieve all stats for the usage range

Because limit was not passed for the find() query, the limit defaulted to 25. As such, when requesting stats for the last 30 days, only the last 25 were retrieved.
This commit is contained in:
Steven Nguyen 2024-05-13 14:17:39 -07:00 committed by GitHub
parent 239a0b4dde
commit 1626168d37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -70,7 +70,7 @@ App::get('/v1/project/usage')
'1d' => 'Y-m-d\T00:00:00.000P',
};
Authorization::skip(function () use ($dbForProject, $firstDay, $lastDay, $period, $metrics, &$total, &$stats) {
Authorization::skip(function () use ($dbForProject, $firstDay, $lastDay, $period, $metrics, $limit, &$total, &$stats) {
foreach ($metrics['total'] as $metric) {
$result = $dbForProject->findOne('stats', [
Query::equal('metric', [$metric]),
@ -85,6 +85,7 @@ App::get('/v1/project/usage')
Query::equal('period', [$period]),
Query::greaterThanEqual('time', $firstDay),
Query::lessThan('time', $lastDay),
Query::limit($limit),
Query::orderDesc('time'),
]);