fix: inconsistent timestamp generation
This commit is contained in:
parent
6925122791
commit
c37e31e6c3
1 changed files with 5 additions and 4 deletions
|
@ -96,15 +96,16 @@ App::get('/v1/project/usage')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$now = time();
|
||||||
foreach ($metrics['period'] as $metric) {
|
foreach ($metrics['period'] as $metric) {
|
||||||
$usage[$metric] = [];
|
$usage[$metric] = [];
|
||||||
$leap = time() - ($limit * $factor);
|
$leap = $now - ($limit * $factor);
|
||||||
while ($leap < time()) {
|
while ($leap < $now) {
|
||||||
$leap += $factor;
|
$leap += $factor;
|
||||||
$formatDate = date($format, $leap);
|
$formatDate = date($format, $leap);
|
||||||
$usage[$metric][] = [
|
$usage[$metric][] = [
|
||||||
'value' => $stats[$metric][$formatDate]['value'] ?? 0,
|
'value' => $stats[$metric][$formatDate]['value'] ?? 0,
|
||||||
'date' => $formatDate,
|
'date' => $formatDate,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue