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

Error Call to undefined method Piwik\\DataTable\\Simple::getComparisons() #16342

Open
tsteur opened this issue Aug 25, 2020 · 12 comments · Fixed by #16840
Open

Error Call to undefined method Piwik\\DataTable\\Simple::getComparisons() #16342

tsteur opened this issue Aug 25, 2020 · 12 comments · Fixed by #16840
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.

Comments

@tsteur
Copy link
Member

tsteur commented Aug 25, 2020

On request index.php?forceView=1&viewDataTable=sparklines&module=Goals&action=get&idGoal=10&allow_multiple=0&only_summary=1&idSite=2&period=day&date=2020-08-17,2020-08-23&segment=&showtitle=1&random=8740

following error happened because a data table map was returned instead of a regular data table. And in this case the first row is a dataTable and not a row.

Error: {"message":"Call to undefined method Piwik\DataTable\Simple::getComparisons()","file":"/plugins/CoreVisualizations/Visualizations/Sparklines.php","line":125,"request_id":"12345","backtrace":" on /plugins/CoreVisualizations/Visualizations/Sparklines.php(125)\n#0 /plugins/CoreVisualizations/Visualizations/Sparklines.php(94): Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines->fetchConfiguredSparklines()\n#1 /core/Plugin/Report.php(320): Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines->render()\n#2 /plugins/CoreHome/Controller.php(58): Piwik\Plugin\Report->render()\n#3 [internal function]: Piwik\Plugins\CoreHome\Controller->renderReportWidget(Object(Piwik\Plugins\Goals\Reports\Get))\n#4 /core/FrontController.php(590): call_user_func_array(Array, Array)\n#5 /core/FrontController.php(165): Piwik\FrontController->doDispatch('Goals', 'get', Array)\n#6 /core/dispatch.php(34): Piwik\FrontController->dispatch()\n#7 /index.php(27): require_once('/c...')\n#8 {main}"}

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Aug 25, 2020
@tsteur tsteur added this to the 4.1.0 milestone Aug 25, 2020
@diosmosis diosmosis self-assigned this Sep 2, 2020
@diosmosis
Copy link
Member

@tsteur where did this URL come from? It's failing because of period=day&date=date1,date2 (ie, it's a multi-period query). I think the sparklines visualization is meant to be just for a single period. The sparkline visualization URLs ( the requests for the actual sparkline images) can handle multiple periods though.

@tsteur
Copy link
Member Author

tsteur commented Sep 3, 2020

@diosmosis it looks like it came from this:

/index.php?forceView=1&viewDataTable=sparklines&module=Goals&action=get&idGoal=6&allow_multiple=0&only_summary=1&idSite=2&period=day&date=2020-08-17,2020-08-23&segment=&showtitle=1&random=2961

@diosmosis
Copy link
Member

@tsteur is the sparklines visualization meant to be used with multi periods?

@tsteur
Copy link
Member Author

tsteur commented Sep 3, 2020

Haven't looked how it works but would have expected that period=day&date=2020-08-17,2020-08-23 shows 7 data points one for each day? I'm not so much into it though

@diosmosis
Copy link
Member

period=day&date=2020-08-17,2020-08-23 range should work, but I've never seen sparklines work w/ multi period. If you sent 10 periods, would it show sparklines and metrics next to them for each 10 periods for each metric in the widget? Seems like it's meant to be a single period.

@tsteur
Copy link
Member Author

tsteur commented Sep 3, 2020

@diosmosis not sure what you mean with multi period? The request URL looks normal I just compared it to a regular request. Why it returned a datatable map not sure. Maybe it does think there's somewhere a multi period or some other issue. The URL was generated by the UI though and also looks good. Maybe some issue with a plugin or something, not sure.

We can look into it after the Matomo 4 release though.

@diosmosis
Copy link
Member

diosmosis commented Sep 3, 2020

There are two visualizations, one is sparklines w/ an s, and the other is sparkline. sparkline shows the image, sparklines shows a sparkline + metric data for a set of metrics. I don't think it's currently supported to support multiple periods since then there would be a sparkline & metric for every period.

EDIT: period=day&date=date1,date2 results in a list of periods, not a range, like period=week&date=date1,date2 results in a list of weeks.

@diosmosis
Copy link
Member

I guess we could make the sparklines visualization work when a multi period is used by summing up the datatable\map, but I don't think it natively supports it and I don't think the period selector UI supports clicking through to such a period.

@tsteur
Copy link
Member Author

tsteur commented Sep 3, 2020

If the generated URL is not correct and it's using a multi period, then we'd need to maybe check how the UI would generate this URL as it's maybe a mistake. I'm pretty certain this URL wasn't generated by the user since the request came from our UI.

Not too important right now though.

@diosmosis diosmosis removed their assignment Sep 7, 2020
@sgiehl
Copy link
Member

sgiehl commented Nov 27, 2020

That actually happens when you call the goals page with "invalid" parameters. e.g. something like
#?idSite=1&period=day&date=2020-11-23,2020-11-26&segment=&category=Goals_Goals&subcategory=General_Overview

Most of the charts actually throw an error in that case. Might be something we could handle better, like not requesting any reports at all and open the date selector directly if the date and period parameter combination isn't supported

@tsteur
Copy link
Member Author

tsteur commented Nov 29, 2020

Sounds good @sgiehl . We could also just show a simple message like "specified date/period combination not supported. please choose a valid date range from the date selector". If it's not trivial we can also simply close the issue though as a wontfix

@sgiehl sgiehl self-assigned this Nov 30, 2020
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Dec 21, 2020
@tsteur
Copy link
Member Author

tsteur commented Sep 7, 2021

Reopening this issue again as it's still a problem. Removing the milestone as we'll work on it only if it happens more often

Call to undefined method Piwik\DataTable\Simple::getComparisons()","file":"/plugins/CoreVisualizations/Visualizations/Sparklines.php","line":126,"request_id":"336ca","backtrace":" on /plugins/CoreVisualizations/Visualizations/Sparklines.php(126)\n#0 /plugins/CoreVisualizations/Visualizations/Sparklines.php(94): Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines->fetchConfiguredSparklines()\n#1 /core/Plugin/Report.php(320): Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines->render()\n#2 l/plugins/CoreHome/Controller.php(59): Piwik\Plugin\Report->render()\n#3 [internal function]:

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. 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 a pull request may close this issue.

4 participants