Skip to content

Resolve "Current active users > historic max"

Tyler Amos requested to merge 12241-current-active-users-historic-max into master

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 and License#historical_max. License#historical_max now leverages HistoricalData.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, memoized prior_historical_max method to avoid these unnecessary computations.

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

Closes #12241 (closed)

Edited by Tyler Amos

Merge request reports