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

Do not use idGoal param for reports with goal metrics #12195

Closed
wants to merge 1 commit into from

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Oct 13, 2017

This is kind of a "quick" fix for #11526. But Row Evolution will show the same as when clicking on it in a non "Goal" report. Alternatively we could also simply deactivate Row Evolution for those Goals reports.

Note: I guess it would be awesome to be able to select the goal metrics for row evolution in this case, but that needs a bit more work.

@sgiehl sgiehl 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 Oct 13, 2017
@@ -317,6 +317,13 @@ private function getRowEvolutionMetaData($idSite, $period, $date, $apiModule, $a
$reportMetadata = API::getInstance()->getMetadata($idSite, $apiModule, $apiAction, $apiParameters, $language,
$period, $date, $hideMetricsDoc = false, $showSubtableReports = true);

// ignore idGoal if no report can be found with it
if (empty($reportMetadata) && isset($apiParameters['idGoal'])) {
Copy link
Member

Choose a reason for hiding this comment

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

if we go with this "hack", be good to leave a comment about it for what it fixes. Wonder if it could lead to some "wrong" results? Probably not?

Did you have a chance to think about what a "proper" fix might look like? Can't think of anything right now apart from having another report instance of all the regular reports with a "idGoal" parameter but this might have other downsides? Like in Reports.addReports event we could maybe add for all "Goal" reports another report instance and set idGoal parameter? Might be just as well a different hack thought and bit more complicated but might enable then other features as well. Really just a random thought and not even sure if it is possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Did you have a chance to think about what a "proper" fix might look like?

No, but I don't think adding additional reports to the reports list would be good. Maybe instead we shouldn't pass a idGoal to the rowevolution in this case, but another param like showGoalMetricsFor or similar to be able to show other metrics within the same report?

Copy link
Member

Choose a reason for hiding this comment

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

Passing idGoal if needed in rowevolution would be a really good solution I reckon, did not think of that. If it is easy possible 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Will have a look as soon as I have some time. Maybe that would a better solution than going with the changes provided in this PR

@sgiehl sgiehl added the Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. label Oct 17, 2017
@sgiehl sgiehl self-assigned this Oct 17, 2017
@sgiehl sgiehl changed the title Ignore idGoal param for row evolution Do not use idGoal param for reports with goal metrics Oct 18, 2017
@sgiehl
Copy link
Member Author

sgiehl commented Oct 18, 2017

I've now updated the implementation. Instead of ignoring possible incorrect idGoal param, I have now renamed the param used to trigger displaying correct goal metrics in goal visualization from idGoal to showGoalMetricsFor. As idGoal is no relevant API parameter for those reports that shouldn't cause any problems.
@tsteur is this solution more suitable?

@mattab mattab added this to the 3.3.0 milestone Oct 19, 2017
@sgiehl sgiehl removed the Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. label Oct 29, 2017
@sgiehl sgiehl removed their assignment Oct 29, 2017
@mattab mattab modified the milestones: 3.3.0, 3.2.2 Nov 20, 2017
@tsteur
Copy link
Member

tsteur commented Dec 15, 2017

I wonder if previous implementation was maybe better as it could break some things. For example when such a report is rendered, in https://github.com/piwik/piwik/pull/12356/files#diff-c337b15b90f57588992ba972d3a21e08R148 I added a check based on the idGoal parameter. Also other plugins may listen to events and do specific things based on the standard idGoal parameter. When fetching the report, this would afterwards maybe no longer work?

@sgiehl
Copy link
Member Author

sgiehl commented Dec 20, 2017

I'll issue a new PR, that will handle that in rowevolution js. Maybe that's the simplest solution right now.

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