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

Fix percentile related key names #11574

Merged
merged 2 commits into from
Oct 23, 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
2 changes: 1 addition & 1 deletion app/Models/DailyChallengeUserStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private function updatePercentile(

foreach ($playlistPercentile as $p => $totalScore) {
if ($highScore->total_score >= $totalScore) {
$this->{"top_{$p}_placements"}++;
$this->{"{$p}_placements"}++;
}
}
$this->last_percentile_calculation = $startTime;
Expand Down
10 changes: 5 additions & 5 deletions app/Models/Multiplayer/PlaylistItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function save(array $options = [])

public function scorePercentile(): array
{
$key = "playlist_item_score_percentile:{$this->getKey()}";
$key = "playlist_item_score_percentile:v2:{$this->getKey()}";

if (!$this->expired && !$this->room->hasEnded()) {
$key .= ':ongoing';
Expand All @@ -134,11 +134,11 @@ public function scorePercentile(): array

return $count === 0
? [
'10p' => 0,
'50p' => 0,
'top_10p' => 0,
'top_50p' => 0,
] : [
'10p' => $scores[max(0, (int) ($count * 0.1) - 1)],
'50p' => $scores[max(0, (int) ($count * 0.5) - 1)],
'top_10p' => $scores[max(0, (int) ($count * 0.1) - 1)],
'top_50p' => $scores[max(0, (int) ($count * 0.5) - 1)],
];
});
}
Expand Down
4 changes: 2 additions & 2 deletions resources/lang/en/rankings.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

'daily_challenge' => [
'beatmap' => 'Difficulty',
'percentile_10' => 'Top 10% Score',
'percentile_50' => 'Top 50% Score',
'top_10p' => 'Top 10% Score',
'top_50p' => 'Top 50% Score',
],

'filter' => [
Expand Down
8 changes: 4 additions & 4 deletions resources/views/rankings/daily_challenge.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@
</div>
<div class="counter-box counter-box--ranking">
<div class="counter-box__title">
{{ osu_trans('rankings.daily_challenge.percentile_10') }}
{{ osu_trans('rankings.daily_challenge.top_10p') }}
</div>
<div class="counter-box__count">
{{ i18n_number_format($percentile['10p']) }}
{{ i18n_number_format($percentile['top_10p']) }}
</div>
</div>
<div class="counter-box counter-box--ranking">
<div class="counter-box__title">
{{ osu_trans('rankings.daily_challenge.percentile_50') }}
{{ osu_trans('rankings.daily_challenge.top_50p') }}
</div>
<div class="counter-box__count">
{{ i18n_number_format($percentile['50p']) }}
{{ i18n_number_format($percentile['top_50p']) }}
</div>
</div>
</div>
Expand Down