Fix DevicePlugins.getPlugin for multi-site multi-period requests#24281
Draft
Fix DevicePlugins.getPlugin for multi-site multi-period requests#24281
Conversation
75ed938 to
20dfaad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
DevicePlugins.getPlugin fails when both multiple sites and multiple periods are requested together, for example:
idSite=1,2&period=day&date=last2
The method handled DataTable\Map results as if they were only one level deep. In the multi-site + multi-period case,
Matomo returns a nested map (site -> period -> DataTable), so the existing loop eventually processed an inner
DataTable\Map as if it were a leaf DataTable.
Fix
This change updates DevicePlugins.getPlugin to traverse the returned tables leaf-by-leaf using multiFilter(), keeping
these result sets aligned at every nesting level:
The VisitsPercent processed metric is now added only to actual leaf DataTable instances, which makes the API work for:
Tests
Added an integration test covering a multi-site + multi-period request and verifying the nested result structure is
processed correctly.
Checklist
Review