1
0
Fork 0
mirror of synced 2024-07-03 13:41:01 +12:00

fix: inconsistent timestamp generation

This commit is contained in:
Torsten Dittmann 2023-12-10 20:58:38 +01:00
parent 6925122791
commit c37e31e6c3

View file

@ -96,15 +96,16 @@ App::get('/v1/project/usage')
}
});
$now = time();
foreach ($metrics['period'] as $metric) {
$usage[$metric] = [];
$leap = time() - ($limit * $factor);
while ($leap < time()) {
$leap = $now - ($limit * $factor);
while ($leap < $now) {
$leap += $factor;
$formatDate = date($format, $leap);
$usage[$metric][] = [
'value' => $stats[$metric][$formatDate]['value'] ?? 0,
'date' => $formatDate,
'value' => $stats[$metric][$formatDate]['value'] ?? 0,
'date' => $formatDate,
];
}
}