billing: Add comment about the calculation in get_latest_seat_count.

Our billing FAQ says:
"For an organization with N other users, 5*N guest users are included at
no extra charge. After that, you will be charged at 1/5 of your regular
per-user pricing for each additional guest.".

It wasn't quite intuitive to me that
max(non_guests, math.ceil(guests / 5)) achieves that pricing, so it's
worth mentioning in a comment that it does and that that's why that
formula is used.
This commit is contained in:
Mateusz Mandera 2022-08-01 10:44:41 +02:00 committed by Tim Abbott
parent 5cc5d15de1
commit 6582a002e7
1 changed files with 4 additions and 0 deletions

View File

@ -66,6 +66,10 @@ def get_latest_seat_count(realm: Realm) -> int:
guests = UserProfile.objects.filter(
realm=realm, is_active=True, is_bot=False, role=UserProfile.ROLE_GUEST
).count()
# This formula achieves the pricing of the first 5*N guests
# being free of charge (where N is the number of non-guests in the organization)
# and each consecutive one being worth 1/5 the non-guest price.
return max(non_guests, math.ceil(guests / 5))