Skip to content

Commit

Permalink
Merge pull request #3083 from catchpoint/lh_metrics_fix
Browse files Browse the repository at this point in the history
handling metricSaving scores
  • Loading branch information
lbartoli79 committed Jul 15, 2024
2 parents 7512a4f + 5878eb1 commit e044c0a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions www/include/lighthouse-page.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,12 @@

$passed = $scoreMode !== 'informative'; // unless info, pass by default
$scoreDesc = "pass";
if (($scoreMode === 'binary' && $score !== 1) || ($scoreMode === 'numeric' && $score < 0.9)) {
$numericScoreModes = ['numeric', 'metricSavings'];
$isScoreNumeric = in_array($scoreMode, $numericScoreModes);
if (($scoreMode === 'binary' && $score !== 1) || ($isScoreNumeric && $score < 0.9)) {
$passed = false;
$scoreDesc = "average";
if ($scoreMode === 'numeric' && $score < 0.5) {
if ($isScoreNumeric && $score < 0.5) {
$scoreDesc = "fail";
}
if ($scoreMode === 'binary' && $score !== 1) {
Expand Down

0 comments on commit e044c0a

Please sign in to comment.