the browser-facing portion of osu!
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add support for exp rank history

nanaya 618e5ae3 bea9ba4f

+61 -2
+6 -2
app/Models/Count.php
··· 19 19 protected $primaryKey = 'name'; 20 20 protected $table = 'osu_counts'; 21 21 22 - public static function currentRankStart(string $mode): static 22 + public static function currentRankStart(string $ruleset): static 23 23 { 24 - return static::firstOrCreate(['name' => "pp_rank_column_{$mode}"], ['count' => 0]); 24 + $column = config('osu.scores.experimental_rank_as_default') 25 + ? "pp_rank_column_exp_{$ruleset}" 26 + : "pp_rank_column_{$ruleset}"; 27 + 28 + return static::firstOrCreate(['name' => $column], ['count' => 0]); 25 29 } 26 30 27 31 public static function totalUsers(): static
+9
app/Models/RankHistory.php
··· 107 107 108 108 public $timestamps = false; 109 109 110 + public function __construct(array $attributes = []) 111 + { 112 + if (config('osu.scores.experimental_rank_as_default')) { 113 + $this->table = 'osu_user_performance_rank_exp'; 114 + } 115 + 116 + parent::__construct($attributes); 117 + } 118 + 110 119 public function getDataAttribute() 111 120 { 112 121 $data = [];
+46
database/migrations/2022_12_12_052806_create_user_performance_rank_exp.php
··· 1 + <?php 2 + 3 + // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4 + // See the LICENCE file in the repository root for full licence text. 5 + 6 + declare(strict_types=1); 7 + 8 + use Illuminate\Database\Migrations\Migration; 9 + use Illuminate\Database\Schema\Blueprint; 10 + use Illuminate\Support\Facades\Schema; 11 + 12 + return new class extends Migration 13 + { 14 + /** 15 + * Run the migrations. 16 + * 17 + * @return void 18 + */ 19 + public function up() 20 + { 21 + Schema::create('osu_user_performance_rank_exp', function (Blueprint $table) { 22 + $table->integer('user_id')->unsigned(); 23 + $table->boolean('mode'); 24 + for ($i = 0; $i < 90; $i++) { 25 + $table->integer("r{$i}")->default(0); 26 + } 27 + $table->primary(['user_id', 'mode']); 28 + }); 29 + 30 + $partitions = 'PARTITION p0 VALUES LESS THAN (1),'; 31 + $partitions .= 'PARTITION p1 VALUES LESS THAN (2),'; 32 + $partitions .= 'PARTITION p2 VALUES LESS THAN (3),'; 33 + $partitions .= 'PARTITION p3 VALUES LESS THAN (4)'; 34 + DB::statement("ALTER TABLE `osu_user_performance_rank_exp` PARTITION BY RANGE (mode) ({$partitions});"); 35 + } 36 + 37 + /** 38 + * Reverse the migrations. 39 + * 40 + * @return void 41 + */ 42 + public function down() 43 + { 44 + Schema::dropIfExists('osu_user_performance_rank_exp'); 45 + } 46 + };