Redefine when revenue information is displayed on All Websites Dashboard #22886
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
In the current All Websites Dashboard (AWD), the
revenue
information is always shown, unless theGoals
plugin is disabled.For the redesigned AWD, this condition will be changed to only display
revenue
information if:Goals
plugin is enabledThis check is done on a per-user basis, a user needs at least view access to any site that would quality for displaying revenue information.
The API
Goals.getGoals
was fixed to properly return goals for multiple sites. The goal list was indexed byidgoal
, but that value is not unique across sites, so if two sites hadidgoal = 1
, you would only get one result instead of two. The API was changed to NOT index the return list with any defined keys to work around this limitation. Requesting goals for a single site will still return them indexed byidgoal
.Fetching 40k goals across 10k sites took a varying time between 500ms and 1250ms in my development environment according to XHProf (around 50% of the total runtime), with most of the time spent in
Goals\API::formatGoal()
. The API will not be called if there is at least one ecommerce site available.Without XHProf active, the response times were always hovering between 175ms and 200ms locally (according to
curl
), and around 75ms to 100ms without any of the new checks.If necessary, we can add an (internal?)
Goals.hasAtLeastOneGoalWithRevenue($idSites)
that could take care of that check in a single database query and circumvent the goal formatting. We can also take this approach if the change toGoals.getGoals
qualifies as a breaking change and can not be done in a feature release, even though it is also a fix.Fixes #5045
Refs DEV-15665
Review