Skip to content

Fix DevicePlugins.getPlugin for multi-site multi-period requests#24281

Draft
sgiehl wants to merge 1 commit into5.x-devfrom
devicepluginsmultimap
Draft

Fix DevicePlugins.getPlugin for multi-site multi-period requests#24281
sgiehl wants to merge 1 commit into5.x-devfrom
devicepluginsmultimap

Conversation

@sgiehl
Copy link
Copy Markdown
Member

@sgiehl sgiehl commented Mar 30, 2026

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:

  • plugin report table
  • browser versions table
  • nb_visits numeric table

The VisitsPercent processed metric is now added only to actual leaf DataTable instances, which makes the API work for:

  • single site / single period
  • single site / multi period
  • multi site / single period
  • multi site / multi period

Tests

Added an integration test covering a multi-site + multi-period request and verifying the nested result structure is
processed correctly.

Checklist

  • [✔] I have understood, reviewed, and tested all AI outputs before use
  • [✔] All AI instructions respect security, IP, and privacy rules

Review

@sgiehl sgiehl added this to the 5.9.0 milestone Mar 30, 2026
@sgiehl sgiehl added the Bug For errors / faults / flaws / inconsistencies etc. label Mar 30, 2026
@sgiehl sgiehl force-pushed the devicepluginsmultimap branch from 75ed938 to 20dfaad Compare March 30, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug For errors / faults / flaws / inconsistencies etc.

Development

Successfully merging this pull request may close these issues.

1 participant