-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 aggregation of additional action metrics #22348
base: 5.x-dev
Are you sure you want to change the base?
Conversation
$newValue = $thisColumnValue; | ||
} else { | ||
$newValue = max($thisColumnValue, $columnToSumValue); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added to handle min and max values the same. Without that all max values would always be 0
, even if there was not a single value tracked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the actual logic behind the code as follows?
case 'max':
if (!is_numeric($thisColumnValue) && !is_numeric($columnToSumValue)) {
$newValue = null;
} else {
$newValue = max(
(is_numeric($thisColumnValue) ? +($thisColumnValue) : -INF),
(is_numeric($columnToSumValue) ? +($columnToSumValue) : -INF)
);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also check implementation of min
.
$newValue = $thisColumnValue; | ||
} else { | ||
$newValue = max($thisColumnValue, $columnToSumValue); | ||
} | ||
break; | ||
case 'min': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation of min
looks like it is not providing the expected result for:
$thisColumnValue = 0
$columnToSumValue = null
Current result: $newValue = null
Expected result: $newValue = 0
This might work as expected:
case 'min':
if (!is_numeric($thisColumnValue) && !is_numeric($columnToSumValue)) {
$newValue = null;
} else {
$newValue = min(
(is_numeric($thisColumnValue) ? +($thisColumnValue) : INF),
(is_numeric($columnToSumValue) ? +($columnToSumValue) : INF)
);
}
Description:
Some plugins like PagePerformance or Bandwidth are adding additional metrics to the action reports. Some of those metrics need to be aggregated using min, max or avg aggregation.
As those column aggregation where not correctly set for the datatables, they were by default aggregated by summing the values up. This resulted in incorrect values.
fixes #22350
Review