Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change display for scores not awared pp #10918

Merged
merged 6 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
],
];
Loading