Skip to content

Commit

Permalink
Add see_also field to calcultation + null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalchevrel committed Dec 14, 2023
1 parent d90055c commit 69849c7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/pchevrel/BzKarma/Scoring.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ class Scoring
'?' => 0,
'---' => 0,
],
'cc' => 0.1, // Decimal point for each cc, we round the total value
'cc' => 0.1, // Decimal point for each cc, we round the total value
'see_also' => 0.5, // Half a point for each b ug in the See Also field, we round the total value
];

/*
Expand Down Expand Up @@ -213,11 +214,12 @@ public function getBugScoreDetails(int $bugNumber): array
'severity' => $this->karma['severity'][$this->bugsDetails[$bugNumber]['severity']] ?? 0,
'type' => $this->karma['type'][$this->bugsDetails[$bugNumber]['type']],
'keywords' => $keywords_value,
'duplicates' => count($this->bugsDetails[$bugNumber]['duplicates']) * $this->karma['duplicates'],
'regressions' => count($this->bugsDetails[$bugNumber]['regressions']) * $this->karma['regressions'],
'duplicates' => count($this->bugsDetails[$bugNumber]['duplicates'] ?? []) * $this->karma['duplicates'],
'regressions' => count($this->bugsDetails[$bugNumber]['regressions'] ?? []) * $this->karma['regressions'],
'webcompat' => $this->getFieldValue($bugNumber, 'cf_webcompat_priority', 'webcompat'),
'perf_impact' => $this->getFieldValue($bugNumber, 'cf_performance_impact', 'perf_impact'),
'cc' => (int) floor(count($this->bugsDetails[$bugNumber]['cc']) * $this->karma['cc']),
'cc' => (int) floor(count($this->bugsDetails[$bugNumber]['cc'] ?? []) * $this->karma['cc']),
'see_also' => (int) floor(count($this->bugsDetails[$bugNumber]['see_also'] ?? []) * $this->karma['see_also']),
'tracking_firefox' . $this->nightly =>
$this->getFieldValue($bugNumber, 'cf_tracking_firefox' . $this->nightly, 'tracking_firefox_nightly'),
'tracking_firefox' . $this->beta =>
Expand Down Expand Up @@ -252,9 +254,10 @@ private function zeroBugScore(): array {
'webcompat' => 0,
'perf_impact' => 0,
'cc' => 0,
'see_also' => 0,
'tracking_firefox' . $this->nightly => 0,
'tracking_firefox' . $this->beta => 0,
'tracking_firefox' . $this->release => 0,
];
}
}
}

0 comments on commit 69849c7

Please sign in to comment.