Fix total_score_without_mods population failing if beatmap was deleted#371
Conversation
There are cases where scores are in the scores table for deleted beatmaps. This can happen when the beatmap creator submits a new version of a beatmap and causes the old one to be completely nuked from the table. From what I can tell, this is the only case that soft deletion is not a thing for the beatmaps table. For such scores we don't really have a recover method, so let's just leave them in a state without this field.
| score.beatmap = beatmapsById[score.beatmap_id]; | ||
| if (!beatmapsById.TryGetValue(score.beatmap_id, out var beatmap)) | ||
| { | ||
| Console.WriteLine($"Skipping score {score.id} (missing beatmap {score.beatmap_id})"); |
There was a problem hiding this comment.
Skipping is fine in the immediate term but something - whether it be setting ranked to zero or whatever else - is going to have to be done later to accommodate for this not actually being universally present e.g. in the command in #269, so that it knows to skip these rows.
Not sure what your plan on that is.
There was a problem hiding this comment.
I think that command would probably be best skip rows with the value missing regardless.
Though having an assertion that the without_multipliers is always present may simplify things in the future, so I can work with that in mind if you think it's best.
There was a problem hiding this comment.
Either way, I think let's get this in and do an initial pass then see how many scores remain in a bad state?
There are cases where scores are in the scores table for deleted beatmaps. This can happen when the beatmap creator submits a new version of a beatmap and causes the old one to be completely nuked from the table. From what I can tell, this is the only case that soft deletion is not a thing for the beatmaps table.
For such scores we don't really have a recover method, so let's just leave them in a state without this field.
Relevant failure: