Skip to content

Commit

Permalink
fix: always calculate budget usage (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz authored Jul 22, 2024
1 parent f63429f commit d97a015
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ func (api *api) GetApp(dbApp *db.App) *App {
//renewsIn := ""
budgetUsage := uint64(0)
maxAmount := uint64(paySpecificPermission.MaxAmountSat)
if maxAmount > 0 {
budgetUsage = queries.GetBudgetUsageSat(api.db, &paySpecificPermission)
}
budgetUsage = queries.GetBudgetUsageSat(api.db, &paySpecificPermission)

response := App{
ID: dbApp.ID,
Expand Down Expand Up @@ -269,9 +267,7 @@ func (api *api) ListApps() ([]App, error) {
if appPermission.Scope == constants.PAY_INVOICE_SCOPE {
apiApp.BudgetRenewal = appPermission.BudgetRenewal
apiApp.MaxAmountSat = uint64(appPermission.MaxAmountSat)
if apiApp.MaxAmountSat > 0 {
apiApp.BudgetUsage = queries.GetBudgetUsageSat(api.db, &appPermission)
}
apiApp.BudgetUsage = queries.GetBudgetUsageSat(api.db, &appPermission)
}
}

Expand Down

0 comments on commit d97a015

Please sign in to comment.