Resolve "Current active users > historic max"
What does this MR do?
We've had plenty of reports of the max historical user count for licenses being less than the current active user count. This MR fixes the max historical user count reported in a few places (Admin User page, Admin License page, salesforce etc) to reflect the historical max for the correct date range. Previously, License#historical_max
used the date range from a year prior to the license start date to the license start date. This logic seems to be needed for the check_users_limit
validation when creating a new license, but is misleading for existing licenses.
This PR also accomplishes two other goals:
- Consolidates the logic for calculating the max historical user count to one location. Previously, similar logic existed in
HistoricalData.max_historical_user_count
andLicense#historical_max
.License#historical_max
now leveragesHistoricalData.max_historical_user_count
to avoid duplicating logic. - Refactors
License#check_users_limit
method.historical_max
was being calculated multiple times in the method. The refactor utilizes a new, memoizedprior_historical_max
method to avoid these unnecessary computations.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Performance and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Closes #12241 (closed)
Edited by Tyler Amos