1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-01 13:47:27 +02:00

fix: incorrect current calculation of ratio (#10567)

Looks like the sinner was looking at the last entry of each data list,
when they are sorted by most recent first.
This commit is contained in:
Thomas Heartman 2025-08-28 15:53:25 +02:00 committed by GitHub
parent 016d269675
commit 709a890bd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,10 +13,7 @@ function getCurrentArchiveRatio(
InstanceInsightsSchema['creationArchiveTrends']
>,
) {
if (
!groupedCreationArchiveData ||
Object.keys(groupedCreationArchiveData).length === 0
) {
if (!groupedCreationArchiveData) {
return 0;
}
@ -24,7 +21,7 @@ function getCurrentArchiveRatio(
let totalCreated = 0;
Object.values(groupedCreationArchiveData).forEach((projectData) => {
const latestData = projectData[projectData.length - 1];
const latestData = projectData[0];
if (latestData) {
totalArchived += latestData.archivedFlags || 0;
const createdSum = latestData.createdFlags