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 problem with metric formatting in cloud visualization #21598

Merged
merged 1 commit into from
Nov 28, 2023
Merged

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Nov 27, 2023

Description:

Changing the requestConfig after the datatable was requested shouldn't be done. We therefor even trigger a warning here:

private function logMessageIfRequestPropertiesHaveChanged(array $requestPropertiesBefore)
{
$requestProperties = $this->requestConfig->getProperties();
$diff = array_diff_assoc($this->makeSureArrayContainsOnlyStrings($requestProperties),
$this->makeSureArrayContainsOnlyStrings($requestPropertiesBefore));
if (!empty($diff['filter_sort_column'])) {
// this here might be ok as it can be changed after data loaded but before filters applied
unset($diff['filter_sort_column']);
}
if (!empty($diff['filter_sort_order'])) {
// this here might be ok as it can be changed after data loaded but before filters applied
unset($diff['filter_sort_order']);
}
if (empty($diff)) {
return;
}
$details = array(
'changedProperties' => $diff,
'apiMethod' => $this->requestConfig->apiMethodToRequestDataTable,
'controller' => $this->config->controllerName . '.' . $this->config->controllerAction,
'viewDataTable' => static::getViewDataTableId()
);
$message = 'Some ViewDataTable::requestConfig properties have changed after requesting the data table. '
. 'That means the changed values had probably no effect. For instance in beforeRender() hook. '
. 'Probably a bug? Details:'
. print_r($details, 1);
Log::warning($message);
}

This is currently done in the cloud visualization to handle problems with formatted/unformatted values.

To reproduce the issue you can simply go the Behaviour > Engagement. Two reports should by default be loaded as Cloud Viz. Rendering them should show the warning message in the logs.

This should also fix random UI test failures like https://builds-artifacts.matomo.org/matomo-org/matomo/5.x-dev/6982498243/UIIntegrationTest_visitors_realtime_visits.png

Review

@sgiehl sgiehl added Bug For errors / faults / flaws / inconsistencies etc. Needs Review PRs that need a code review labels Nov 27, 2023
@sgiehl sgiehl added this to the 5.0.0 milestone Nov 27, 2023
@sgiehl sgiehl requested a review from a team November 27, 2023 16:11
Copy link
Contributor

@bx80 bx80 left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@sgiehl sgiehl merged commit d7a1baf into 5.x-dev Nov 28, 2023
22 of 25 checks passed
@sgiehl sgiehl deleted the fixtagcloud branch November 28, 2023 09:44
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. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants