Skip to content

Commit 0bea08e

Browse files
committed
[usage] Update formula: 1 credit = 6 minutes, rounded up
1 parent 84bac46 commit 0bea08e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

components/usage/pkg/stripe/stripe.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package stripe
77
import (
88
"encoding/json"
99
"fmt"
10+
"math"
1011
"os"
1112
"strings"
1213

@@ -111,6 +112,7 @@ func queriesForCustomersWithTeamIds(teamIds []string) []string {
111112
}
112113

113114
// workspaceSecondsToCredits converts seconds (of workspace usage) into Stripe credits.
115+
// (1 credit = 6 minutes, rounded up)
114116
func workspaceSecondsToCredits(seconds int64) int64 {
115-
return (seconds + 59) / 60
117+
return int64(math.Ceil(float64(seconds) / (60 * 6)))
116118
}

0 commit comments

Comments
 (0)