Skip to content

Commit

Permalink
Merge pull request #11189 from nanaya/score-rank-float
Browse files Browse the repository at this point in the history
Fix score accuracy comparison
  • Loading branch information
peppy authored May 2, 2024
2 parents 1a86fc2 + 099da54 commit 593cd0f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/Models/Traits/Scoreable.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function recalculateRank(): void
$ratio50 = $totalHits === 0 ? 1 : $this->count50 / $totalHitCount;

$this->rank = match (true) {
$ratio300 === 1 =>
$ratio300 === 1.0 =>
$this->shouldHaveHiddenRank() ? 'XH' : 'X',
$ratio300 > 0.9 && $ratio50 <= 0.01 && $countMiss === 0 =>
$this->shouldHaveHiddenRank() ? 'SH' : 'S',
Expand All @@ -113,7 +113,7 @@ public function recalculateRank(): void
$ratio50 = $totalHits === 0 ? 1 : $this->count50 / $totalHitCount;

$this->rank = match (true) {
$ratio300 === 1 =>
$ratio300 === 1.0 =>
$this->shouldHaveHiddenRank() ? 'XH' : 'X',
$ratio300 > 0.9 && $ratio50 < 0.01 && $countMiss === 0 =>
$this->shouldHaveHiddenRank() ? 'SH' : 'S',
Expand All @@ -131,7 +131,7 @@ public function recalculateRank(): void

case 'fruits':
$this->rank = match (true) {
$accuracy === 1 =>
$accuracy === 1.0 =>
$this->shouldHaveHiddenRank() ? 'XH' : 'X',
$accuracy > 0.98 =>
$this->shouldHaveHiddenRank() ? 'SH' : 'S',
Expand All @@ -149,7 +149,7 @@ public function recalculateRank(): void

case 'mania':
$this->rank = match (true) {
$accuracy === 1 =>
$accuracy === 1.0 =>
$this->shouldHaveHiddenRank() ? 'XH' : 'X',
$accuracy > 0.95 =>
$this->shouldHaveHiddenRank() ? 'SH' : 'S',
Expand Down

0 comments on commit 593cd0f

Please sign in to comment.