-
Notifications
You must be signed in to change notification settings - Fork 390
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
Update score table structure #10869
Update score table structure #10869
Conversation
- a bunch of attributes are moved out of the json - pp and legacy id moved to main scores table
a1e9daf
to
efcdec8
Compare
I did some local full-stack testing and this breaks down a bit at the connection to The shape of the json that As far as I can tell, the following diff seems to fix: diff --git a/app/Models/Solo/Score.php b/app/Models/Solo/Score.php
index dcbf823195..dcb382d00e 100644
--- a/app/Models/Solo/Score.php
+++ b/app/Models/Solo/Score.php
@@ -120,10 +120,19 @@ class Score extends Model implements Traits\ReportableInterface
{
LaravelRedis::lpush(static::PROCESSING_QUEUE, json_encode([
'Score' => [
- 'beatmap_id' => $scoreJson['beatmap_id'],
'id' => $scoreJson['id'],
- 'ruleset_id' => $scoreJson['ruleset_id'],
'user_id' => $scoreJson['user_id'],
+ 'beatmap_id' => $scoreJson['beatmap_id'],
+ 'ruleset_id' => $scoreJson['ruleset_id'],
+ 'has_replay' => $scoreJson['has_replay'],
+ 'rank' => $scoreJson['rank'],
+ 'passed' => $scoreJson['passed'],
+ 'accuracy' => $scoreJson['accuracy'],
+ 'max_combo' => $scoreJson['max_combo'],
+ 'total_score' => $scoreJson['total_score'],
+ 'started_at' => $scoreJson['started_at'],
+ 'ended_at' => $scoreJson['ended_at'],
+ 'build_id' => $scoreJson['build_id'],
// TODO: processor is currently order dependent and requires
// this to be located at the end
'data' => json_encode($scoreJson),
diff --git a/app/Transformers/ScoreTransformer.php b/app/Transformers/ScoreTransformer.php
index 31188c8ee5..64eeddd0e7 100644
--- a/app/Transformers/ScoreTransformer.php
+++ b/app/Transformers/ScoreTransformer.php
@@ -128,8 +128,10 @@ class ScoreTransformer extends TransformerAbstract
$ret['build_id'] = $score->build_id;
$ret['ended_at'] = $score->ended_at_json;
$ret['has_replay'] = $score->has_replay;
+ $ret['max_combo'] = $score->max_combo;
$ret['maximum_statistics'] = $data->maximumStatistics;
$ret['mods'] = $data->mods;
+ $ret['passed'] = $score->passed;
$ret['pp'] = $score->pp;
$ret['ruleset_id'] = $score->ruleset_id;
$ret['started_at'] = $score->started_at_json;
although with a few caveats:
The usual disclaimer of "I have barely any idea what I'm doing here" applies. |
It expects database row structure so just give it database row structure.
Add new score attributes to legacy model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
score-helper
and solo-score-json
also need an update since legacy_total_score
isn't nullable now and only legacy_score_id
is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems fine 👀
This and #10884 can just be merged and deployed (after adding the migration entry) |
This uses raw sql for migration due to laravel not supporting float until laravel 11. Also the syntax just not being very helpful in the first place (if anything the migration result has been occasionally changed between laravel versions).
Indexer image points to my own published image because the changes need ppy/osu-elastic-indexer#154 to be properly tested.
I considered making everything flat - as in handling maximum_statistics, statistics, and mods directly from Score model - but it'd involve even more changes dealing with partial ScoreData assignment so maybe later if at all.
2024_01_12_115738_update_scores_table_final