Skip to content

Commit

Permalink
Merge pull request ppy#10865 from nanaya/score-f
Browse files Browse the repository at this point in the history
Support displaying F rank and make it default for fail scores
  • Loading branch information
notbakaneko authored Jan 15, 2024
2 parents e298042 + 2103aa2 commit d0515cd
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/Models/Solo/Score.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static function createFromJsonOrExplode(array $params)
// older lazer builds potentially submit incorrect details here (and we still want to
// accept their scores.
if (!$score->data->passed) {
$score->data->rank = 'D';
$score->data->rank = 'F';
}

$score->saveOrExplode();
Expand Down
22 changes: 22 additions & 0 deletions public/images/badges/score-ranks-v2019/GradeSmall-F.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 9 additions & 8 deletions resources/css/bem/score-rank.less
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
background-image: url("~@images/badges/score-ranks-v2019/GradeSmall-@{filename}.svg?3");
}

.all(XH, "SS-Silver");
.all(X, "SS");
.all(SH, "S-Silver");
.all(S, "S");
.all(A, "A");
.all(B, "B");
.all(C, "C");
.all(D, "D");
.all(~"XH", "SS-Silver");
.all(~"X", "SS");
.all(~"SH", "S-Silver");
.all(~"S", "S");
.all(~"A", "A");
.all(~"B", "B");
.all(~"C", "C");
.all(~"D", "D");
.all(~"F", "F");

&--full {
.full-size();
Expand Down
2 changes: 1 addition & 1 deletion resources/js/interfaces/rank.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

type Rank = 'A' | 'B' | 'C' | 'D' | 'S' | 'SH' | 'X' | 'XH';
type Rank = 'A' | 'B' | 'C' | 'D' | 'F' | 'S' | 'SH' | 'X' | 'XH';

export default Rank;
1 change: 1 addition & 0 deletions resources/js/scores-show/dial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const displayRank: Record<Rank, string> = {
B: 'B',
C: 'C',
D: 'D',
F: 'F',
S: 'S',
SH: 'S',
X: 'SS',
Expand Down
1 change: 1 addition & 0 deletions resources/js/scores-show/tower.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const rankIntMap: Record<Rank, number> = {
B: 2,
C: 1,
D: 0,
F: -1,
S: 4,
SH: 4,
X: 5,
Expand Down
6 changes: 3 additions & 3 deletions tests/Models/Solo/ScoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function testLegacyPassScoreRetainsRank()
$this->assertSame($legacy->rank, 'S');
}

public function testLegacyFailScoreIsRankD()
public function testLegacyFailScoreIsRankF()
{
$score = Score::createFromJsonOrExplode([
'accuracy' => 1,
Expand All @@ -76,12 +76,12 @@ public function testLegacyFailScoreIsRankD()
]);

$this->assertFalse($score->data->passed);
$this->assertSame($score->data->rank, 'D');
$this->assertSame($score->data->rank, 'F');

$legacy = $score->createLegacyEntryOrExplode();

$this->assertFalse($legacy->perfect);
$this->assertSame($legacy->rank, 'D');
$this->assertSame($legacy->rank, 'F');
}

public function testLegacyScoreHitCounts()
Expand Down

0 comments on commit d0515cd

Please sign in to comment.