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

Fix "Pivot is not correctly remembered" #9951

Merged
merged 3 commits into from Mar 29, 2016
Merged

Fix "Pivot is not correctly remembered" #9951

merged 3 commits into from Mar 29, 2016

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Mar 20, 2016

Moving all logic from the separate PivotBy viz to the HtmlTable viz solves the problem.

fixes #9667

might also be a solution for #9716

@sgiehl sgiehl added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Mar 20, 2016
@sgiehl sgiehl added this to the 2.16.1 milestone Mar 20, 2016
{
// Both are the same HtmlTable, just the Pivot one has some extra logic in case Pivot is used.
// We don't want to use the same HtmlTable twice in the UI. Therefore we always need to remove one.
if (Common::getRequestVar('pivotBy', '')) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This actually caused the problem, as for an initially loaded report no request vars are set.

@@ -143,7 +143,8 @@ public function configureViewDataTable(ViewDataTable $view)
$secondaryDimension = $this->getSecondaryDimensionFromRequest();
$view->config->subtable_controller_action = API::getInstance()->getActionToLoadSubtables($apiMethod, $secondaryDimension);

if (Common::getRequestVar('pivotBy', false) === false) {
$pivotBy = Common::getRequestVar('pivotBy', false);
if (empty($pivotBy)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

When unsetting the pivot pivotByis set to the string 0. This wasn't catched here, so the displayed columns were incorrect in this case.


public function beforeLoadDataTable()
{
$this->requestConfig->request_parameters_to_modify['pivotBy'] = null; // always unset pivotBy
Copy link
Member Author

Choose a reason for hiding this comment

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

this fixes another issue that was occurring when switching to all columns view after pivot was activated.

@tsteur
Copy link
Member

tsteur commented Mar 29, 2016

Have you seen the 2 failing UI tests? http://builds-artifacts.piwik.org/piwik/piwik/pivot_9667/18398/PivotByDimension_pivoted_columns_report and http://builds-artifacts.piwik.org/piwik/piwik/pivot_9667/18398/PivotByDimension_pivoted ? I tried to find a CSS selector that matches pivotby dataTable but couldn't really find anything but there are now some CSS classes matching like dataTableVizHtmlTable etc. I presume we can still merge and it is expected. 👍

@sgiehl
Copy link
Member Author

sgiehl commented Mar 29, 2016

@tsteur Yes, the small changes in the UI tests are because the css class of the datatable changed. But it is somehow expected.

@tsteur tsteur merged commit 8653fc7 into master Mar 29, 2016
@tsteur tsteur deleted the pivot_9667 branch March 29, 2016 19:24
@mattab
Copy link
Member

mattab commented Mar 30, 2016

Good find @sgiehl ! 👍

mattab added a commit that referenced this pull request Mar 30, 2016
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

3 participants