Merge pull request #15322 from Budibase/cheeks-fixes

Fix usage calculations
This commit is contained in:
Andrew Kingston 2025-01-08 09:32:11 +00:00 committed by GitHub
commit 2391bfd15b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -227,7 +227,7 @@ class LicensingStore extends BudiStore<LicensingState> {
MonthlyQuotaName.AUTOMATIONS,
].reduce((acc: MonthlyMetrics, key) => {
const limit = license.quotas.usage.monthly[key].value
const used = (usage.monthly.current?.[key] || 0 / limit) * 100
const used = ((usage.monthly.current?.[key] || 0) / limit) * 100
acc[key] = limit > -1 ? Math.floor(used) : -1
return acc
}, {})
@ -236,7 +236,7 @@ class LicensingStore extends BudiStore<LicensingState> {
const staticMetrics = [StaticQuotaName.APPS, StaticQuotaName.ROWS].reduce(
(acc: StaticMetrics, key) => {
const limit = license.quotas.usage.static[key].value
const used = (usage.usageQuota[key] || 0 / limit) * 100
const used = ((usage.usageQuota[key] || 0) / limit) * 100
acc[key] = limit > -1 ? Math.floor(used) : -1
return acc
},