mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-13 13:48:59 +02:00
fix: N/A only on NaN
Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
parent
c24045dc99
commit
aea2f613df
@ -159,7 +159,7 @@ describe('useFilteredFlagTrends', () => {
|
||||
potentiallyStale: 0,
|
||||
averageUsers: 0,
|
||||
averageHealth: undefined,
|
||||
flagsPerUser: 'N/A',
|
||||
flagsPerUser: '0.0',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -42,14 +42,14 @@ export const useFilteredFlagsSummary = (
|
||||
},
|
||||
);
|
||||
|
||||
const flagsPerUser = users?.total ? sum.total / users.total : 0;
|
||||
const flagsPerUserCalculation = sum.total / users.total;
|
||||
const flagsPerUser = Number.isNaN(flagsPerUserCalculation)
|
||||
? 'N/A'
|
||||
: flagsPerUserCalculation.toFixed(1);
|
||||
|
||||
return {
|
||||
...sum,
|
||||
flagsPerUser:
|
||||
Number.isNaN(flagsPerUser) || flagsPerUser === 0
|
||||
? 'N/A'
|
||||
: flagsPerUser.toFixed(1),
|
||||
flagsPerUser,
|
||||
averageUsers,
|
||||
averageHealth: sum.total
|
||||
? ((sum.active / (sum.total || 1)) * 100).toFixed(0)
|
||||
|
Loading…
Reference in New Issue
Block a user