forked from ppy/osu-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
211 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
// 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. | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Models; | ||
|
||
/** | ||
* @property int $id | ||
* @property string $image_url | ||
* @property string $name | ||
* @property int $season_id | ||
* @property int $threshold | ||
*/ | ||
class Division extends Model | ||
{ | ||
public $timestamps = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
'achievement' => [ | ||
'icon_prefix' => env('USER_ACHIEVEMENT_ICON_PREFIX', 'https://assets.ppy.sh/user-achievements/'), | ||
], | ||
|
||
'api' => [ | ||
// changing the throttle rate doesn't reset any existing timers, | ||
// changing the prefix key is the only way to invalidate them. | ||
|
@@ -27,15 +26,13 @@ | |
'scores_download' => env('API_THROTTLE_SCORES_DOWNLOAD', '10,1,api-scores-download'), | ||
], | ||
], | ||
|
||
'avatar' => [ | ||
'cache_purge_prefix' => env('AVATAR_CACHE_PURGE_PREFIX'), | ||
'cache_purge_method' => env('AVATAR_CACHE_PURGE_METHOD'), | ||
'cache_purge_authorization_key' => env('AVATAR_CACHE_PURGE_AUTHORIZATION_KEY'), | ||
'default' => env('DEFAULT_AVATAR', env('APP_URL', 'http://localhost').'/images/layout/[email protected]'), | ||
'storage' => env('AVATAR_STORAGE', 'local-avatar'), | ||
], | ||
|
||
'bbcode' => [ | ||
// this should be random or a config variable. | ||
// ...who am I kidding, this shouldn't even exist at all. | ||
|
@@ -193,12 +190,13 @@ | |
'processing_queue' => presence(env('SCORES_PROCESSING_QUEUE')) ?? 'osu-queue:score-statistics', | ||
'submission_enabled' => get_bool(env('SCORES_SUBMISSION_ENABLED')) ?? true, | ||
], | ||
|
||
'seasonal' => [ | ||
'contest_id' => get_int(env('SEASONAL_CONTEST_ID')), | ||
'ends_at' => env('SEASONAL_ENDS_AT'), | ||
], | ||
|
||
'seasons' => [ | ||
'divisions_cache_duration' => 60 * (get_float(env('DIVISIONS_CACHE_DURATION')) ?? 60), // in minutes, converted to seconds | ||
], | ||
'store' => [ | ||
'notice' => presence(str_replace('\n', "\n", env('STORE_NOTICE') ?? '')), | ||
], | ||
|
37 changes: 37 additions & 0 deletions
37
database/migrations/2025_01_06_203319_create_divisions_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
// 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. | ||
|
||
declare(strict_types=1); | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::create('divisions', function (Blueprint $table) { | ||
$table->id(); | ||
$table->integer('season_id')->unsigned(); | ||
$table->string('name'); | ||
$table->string('image_url'); | ||
$table->float('threshold'); | ||
|
||
$table->index(['season_id', 'threshold']); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::dropIfExists('divisions'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{{-- | ||
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. | ||
--}} | ||
|
||
@php | ||
$currentDivision = $divisions[0]; | ||
@endphp | ||
|
||
<table class="ranking-page-table"> | ||
<thead> | ||
<tr> | ||
<th class="ranking-page-table__heading"></th> | ||
<th class="ranking-page-table__heading ranking-page-table__heading--main"></th> | ||
<th class="ranking-page-table__heading"> | ||
{{ osu_trans('rankings.stat.total_score') }} | ||
</th> | ||
<th class="ranking-page-table__heading ranking-page-table__heading--focused"> | ||
{{ osu_trans('rankings.stat.division') }} | ||
</th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
@foreach ($scores as $index => $score) | ||
@php | ||
$rank = $scores->firstItem() + $index; | ||
if ($rank > $currentDivision['absolute_threshold']) { | ||
foreach ($divisions as $division) { | ||
if ($rank <= $division['absolute_threshold']) { | ||
$currentDivision = $division; | ||
break; | ||
} | ||
} | ||
} | ||
@endphp | ||
|
||
<tr class="ranking-page-table__row{{$score->user->isActive() ? '' : ' ranking-page-table__row--inactive'}}"> | ||
<td class="ranking-page-table__column ranking-page-table__column--rank"> | ||
#{{ $rank }} | ||
</td> | ||
<td class="ranking-page-table__column"> | ||
<div class="ranking-page-table__user-link"> | ||
<span class="ranking-page-table__flags"> | ||
@include('objects._flag_country', [ | ||
'country' => $score->user->country, | ||
]) | ||
@if (($team = $score->user->team) !== null) | ||
<a class="u-contents" href="{{ route('teams.show', $team) }}"> | ||
@include('objects._flag_team', compact('team')) | ||
</a> | ||
@endif | ||
</span> | ||
<a | ||
href="{{ route('users.show', ['user' => $score->user_id]) }}" | ||
class="ranking-page-table__user-link-text js-usercard" | ||
data-user-id="{{ $score->user_id }}" | ||
data-tooltip-position="right center" | ||
> | ||
{{ $score->user->username }} | ||
</a> | ||
</div> | ||
</td> | ||
<td class="ranking-page-table__column ranking-page-table__column--dimmed"> | ||
{!! i18n_number_format($score->total_score) !!} | ||
</td> | ||
<td class="ranking-page-table__column ranking-page-table__column--division"> | ||
{{ $currentDivision['division']->name }} | ||
</td> | ||
</tr> | ||
@endforeach | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters