Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better fetching of saved report parameters by report ID #11983

Merged
merged 4 commits into from Sep 26, 2017
Merged

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Aug 28, 2017

When fetching saved report parameters (from the DB options table, parameters that were changed eg when changing sort order etc), we currently fetch the report parameters based on the controller action. If there are many reports available for the same report, they all apply the same viewDataTableParams.

One problem is, whenever someone changes the report, those parameters will be saved towards the Report ID, but not the controller action see https://github.com/piwik/piwik/blob/3.0.5-b2/plugins/CoreHome/javascripts/dataTable.js#L1501-L1509

This means a changed data table will never be applied for some reports. And if it was saved, it would be applied to all entities. This is why the report ID should be preferred over a plain controller action as it included eg also a goal id.

Need to see if tests still pass...

@tsteur tsteur added Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. labels Aug 28, 2017
@tsteur tsteur added this to the 3.2.0 milestone Aug 28, 2017

$paramsKey = $this->getModule() . '.' . $this->getAction();

if (!empty($params)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is somewhat duplicated logic from ProcessedReport but didn't want to make the method static etc. Eventually, ProcessedReport will directly work on the report classes instead of some arrays and then we have it only in one place.

if ($loadViewDataTableParametersForUser) {
$login = Piwik::getCurrentUserLogin();
$params = Manager::getViewDataTableParameters($login, $controllerAction);
$paramsKey = $controllerAction;
if (!empty($report) && $controllerAction === $apiAction) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be important to only apply it to the "default action" when controller and API is the same, at least for now... Not sure about implications of removing $controllerAction === $apiAction as it could potentially apply settings of eg a table report to a graph report...

@mattab mattab modified the milestones: 3.2.0, 3.1.2 Sep 21, 2017
@mattab mattab merged commit 948e1f0 into 3.x-dev Sep 26, 2017
@mattab mattab deleted the reportparamid branch September 26, 2017 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants