Skip to content

Commit

Permalink
Merge pull request #10918 from notbakaneko/play-details-no-ranked-no-pp
Browse files Browse the repository at this point in the history
Change display for scores not awared pp
  • Loading branch information
nanaya authored Jan 30, 2024
2 parents c5c0e93 + 61cd517 commit 96356e7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/Transformers/ScoreTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ public function transformSolo(MultiplayerScoreLink|ScoreModel|SoloScore $score)
$score = $score->score;
}

if ($score instanceof SoloScore) {
$extraAttributes['ranked'] = $score->ranked;
}

$hasReplay = $score->has_replay;

return [
Expand Down
1 change: 1 addition & 0 deletions resources/js/interfaces/solo-score-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type SoloScoreJsonDefaultAttributes = {
passed: boolean;
pp: number | null;
rank: Rank;
ranked?: boolean;
ruleset_id: number;
started_at: string | null;
statistics: Partial<Record<SoloScoreStatisticsAttribute, number>>;
Expand Down
5 changes: 4 additions & 1 deletion resources/js/scores/pp-value.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ export default function PpValue(props: Props) {
if (!isBest && !isSolo) {
title = trans('scores.status.non_best');
content = '-';
} else if (props.score.ranked === false) {
title = trans('scores.status.no_pp');
content = '-';
} else if (props.score.pp == null) {
if (isSolo && !props.score.passed) {
title = trans('scores.status.non_passing');
content = '-';
} else {
title = trans('scores.status.processing');
content = <span className='fas fa-exclamation-triangle' />;
content = <span className='fas fa-sync' />;
}
} else {
title = formatNumber(props.score.pp);
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/scores.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
'status' => [
'non_best' => 'Only personal best scores award pp',
'non_passing' => 'Only passing scores award pp',
'no_pp' => 'pp is not awarded for this score',
'processing' => 'This score is still being calculated and will be displayed soon',
],
];

0 comments on commit 96356e7

Please sign in to comment.