Use the latest guest user count from the `UsersStatistics` record when validating ultimate licenses
Problem
When applying an Ultimate license to a Premium self-managed instance, the license validation fails if the last recorded billable_user_count
is greater than the seats on the Ultimate subscription.
However, guest users are not billable in Ultimate subscriptions which is why having an Ultimate license with a smaller seat count could be a valid scenario.
Related to #370026 (closed)
Proposal
The Users::CreateStatisticsWorker
runs everyday at 15:02 and records the number of guest users among other counts.
When the license being validated is Ultimate (exclude_guests_from_active_count?
), check that daily_billable_user_count - users_with_highest_role_guest
is still within the user count limit of the new license (<= restricted_user_count_with_threshold
).