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