Skip to content

Commit

Permalink
Merge branch 'master' into grade-circles
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach committed Oct 11, 2024
2 parents a86ce41 + a430cf1 commit 8f58f1f
Show file tree
Hide file tree
Showing 26 changed files with 296 additions and 288 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ CLIENT_CHECK_VERSION=false
# BAN_PERSIST_DAYS=28

# ES_HOST=localhost:9200
# ES_SCORES_HOST=localhost:9200
# ES_SOLO_SCORES_HOST=localhost:9200
# ES_INDEX_PREFIX=
# ES_CLIENT_TIMEOUT=5
Expand Down
30 changes: 0 additions & 30 deletions app/Console/Commands/UserBestScoresCheckCommand.php

This file was deleted.

12 changes: 0 additions & 12 deletions app/Http/Controllers/LegacyInterOpController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use App\Jobs\Notifications\ForumTopicReply;
use App\Jobs\RegenerateBeatmapsetCover;
use App\Libraries\Chat;
use App\Libraries\UserBestScoresCheck;
use App\Models\Beatmap;
use App\Models\Beatmapset;
use App\Models\Chat\Channel;
Expand Down Expand Up @@ -297,17 +296,6 @@ public function userBatchSendMessage()
return response()->json($results);
}

public function userBestScoresCheck($id)
{
$user = User::findOrFail($id);

foreach (Beatmap::MODES as $mode => $_v) {
(new UserBestScoresCheck($user))->run($mode);
}

return ['success' => true];
}

public function userIndex($id)
{
$user = User::findOrFail($id);
Expand Down
9 changes: 9 additions & 0 deletions app/Http/Controllers/ScoresController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use App\Enums\Ruleset;
use App\Models\Score\Best\Model as ScoreBest;
use App\Models\ScoreReplayStats;
use App\Models\Solo\Score as SoloScore;
use App\Transformers\ScoreTransformer;
use App\Transformers\UserCompactTransformer;
Expand Down Expand Up @@ -58,6 +59,8 @@ public function download($rulesetOrSoloId, $id = null)
::where('score_id', $id)
->where('replay', true)
->firstOrFail();

$soloScore = SoloScore::firstWhere('legacy_score_id', $score->getKey());
}

$file = $score->getReplayFile();
Expand Down Expand Up @@ -89,6 +92,12 @@ public function download($rulesetOrSoloId, $id = null)
->firstOrCreate([], ['play_count' => 0])
->incrementInstance('play_count');
}

if ($soloScore !== null) {
ScoreReplayStats
::createOrFirst(['score_id' => $soloScore->getKey()], ['user_id' => $soloScore->user_id])
->incrementInstance('watch_count');
}
}
}

Expand Down
8 changes: 0 additions & 8 deletions app/Jobs/RemoveBeatmapsetBestScores.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
namespace App\Jobs;

use App\Libraries\Elasticsearch\BoolQuery;
use App\Libraries\Elasticsearch\Es;
use App\Models\Beatmap;
use App\Models\Beatmapset;
use App\Models\Score\Best\Model;
Expand Down Expand Up @@ -57,13 +56,6 @@ public function handle()
$query->filter(['terms' => ['beatmap_id' => $beatmapIds]]);
$query->filter(['range' => ['score_id' => ['lte' => $this->maxScoreIds[$mode]]]]);

// TODO: do something with response?
Es::getClient('scores')->deleteByQuery([
'index' => $GLOBALS['cfg']['osu']['elasticsearch']['prefix']."high_scores_{$mode}",
'body' => ['query' => $query->toArray()],
'client' => ['ignore' => 404],
]);

$class = Model::getClass($mode);
// Just delete until no more matching rows.
$query = $class
Expand Down
116 changes: 0 additions & 116 deletions app/Libraries/UserBestScoresCheck.php

This file was deleted.

14 changes: 14 additions & 0 deletions app/Models/ScoreReplayStats.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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;

class ScoreReplayStats extends Model
{
public $incrementing = false;
protected $primaryKey = 'score_id';
}
3 changes: 0 additions & 3 deletions config/elasticsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
'default' => array_merge($defaults, [
'hosts' => $parseHosts('ES_HOST'),
]),
'scores' => array_merge($defaults, [
'hosts' => $parseHosts('ES_SCORES_HOST'),
]),
'solo_scores' => array_merge($defaults, [
'hosts' => $parseHosts('ES_SOLO_SCORES_HOST'),
]),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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
{
public function up(): void
{
Schema::create('score_replay_stats', function (Blueprint $table) {
$table->bigInteger('score_id')->unsigned()->primary();
$table->bigInteger('user_id')->unsigned();
$table->integer('watch_count')->unsigned()->default(0);
$table->index(['user_id', 'watch_count']);
$table->index('watch_count');
$table->timestamps();
});
}

public function down(): void
{
Schema::dropIfExists('score_replay_stats');
}
};
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ x-env: &x-env
DB_CONNECTION_STRING: Server=db;Database=osu;Uid=osuweb;
DB_HOST: db
ES_HOST: http://elasticsearch:9200
ES_SCORES_HOST: http://elasticsearch:9200
ES_SOLO_SCORES_HOST: http://elasticsearch:9200
GITHUB_TOKEN: "${GITHUB_TOKEN}"
NOTIFICATION_REDIS_HOST: redis
Expand Down
9 changes: 5 additions & 4 deletions resources/css/bem/comment-editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
@_spacing: 10px;
@_border-radius: @border-radius-large;

--bg: hsl(var(--hsl-b3));
border-radius: @_border-radius;
display: flex;
flex-direction: column;
background-color: @osu-colour-b3;
border: 2px solid @osu-colour-b3;
background: var(--bg);
position: relative;

&--fancy {
Expand Down Expand Up @@ -62,14 +62,15 @@
padding: @_spacing;
font-size: @font-size--phone-input;
border-radius: @_border-radius @_border-radius 0 0;
resize: none;
border: 2px solid var(--bg);
border-bottom: none;
background-color: @osu-colour-b5;
resize: none;

@media @desktop {
font-size: inherit;
}

color: white;
&::placeholder {
color: @osu-colour-f1;
}
Expand Down
Loading

0 comments on commit 8f58f1f

Please sign in to comment.