-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add command to reprocess playlist total scores to *old* standardised scores #136
Conversation
private long ensureCorrectTotalScore(MultiplayerScore score, MultiplayerPlaylistItem playlistItem) | ||
{ | ||
Ruleset ruleset = LegacyRulesetHelper.GetRulesetFromLegacyId(playlistItem.ruleset_id); | ||
|
||
HitResult maxRulesetJudgement = ruleset.GetHitResults().First().result; | ||
|
||
Dictionary<HitResult, int> statistics = JsonConvert.DeserializeObject<Dictionary<HitResult, int>>(score.statistics)!; | ||
|
||
List<HitResult> allHits = statistics | ||
.SelectMany(kvp => Enumerable.Repeat(kvp.Key, kvp.Value)) | ||
.ToList(); | ||
|
||
var maximumStatistics = new Dictionary<HitResult, int>(); | ||
|
||
foreach (var groupedStats in allHits | ||
.Select(r => getMaxJudgementFor(r, maxRulesetJudgement)) | ||
.GroupBy(r => r)) | ||
{ | ||
maximumStatistics[groupedStats.Key] = groupedStats.Count(); | ||
} | ||
|
||
APIMod[] roomMods = JsonConvert.DeserializeObject<APIMod[]>(playlistItem.required_mods)!; | ||
APIMod[] scoreMods = JsonConvert.DeserializeObject<APIMod[]>(score.mods)!; | ||
|
||
foreach (var m in roomMods) | ||
Debug.Assert(scoreMods.Contains(m)); | ||
|
||
ScoreInfo scoreInfo = new ScoreInfo | ||
{ | ||
Statistics = statistics, | ||
MaximumStatistics = maximumStatistics, | ||
Ruleset = ruleset.RulesetInfo, | ||
MaxCombo = score.max_combo, | ||
APIMods = scoreMods | ||
}; | ||
|
||
return StandardisedScoreMigrationTools.GetOldStandardised(scoreInfo); | ||
} |
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.
This is the main part I want eyes on. @smoogipoo
Sample run:
|
APIMod[] roomMods = JsonConvert.DeserializeObject<APIMod[]>(playlistItem.required_mods)!; | ||
APIMod[] scoreMods = JsonConvert.DeserializeObject<APIMod[]>(score.mods)!; | ||
|
||
foreach (var m in roomMods) |
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.
This is just a safety I added to be sure that the scores include any room mods, since it was easier to add this than check it's the case.
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.
Looks fine to me
This should not be merged without a new osu.Game release + #135.
PR is intended for review purposes. Hopefully this will only ever be run twice.