Skip to content
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

Store maximum statistics to spectator state #21587

Merged
merged 5 commits into from
Dec 12, 2022

Conversation

smoogipoo
Copy link
Contributor

This is a breaking change which will need a new osu-server-spectator deploy.

Storing the maximum scoring values was a mistake. In order to eventually construct replays server-side, we need to have the full statistics - basically everything that ScoreInfo/SoloScoreInfo needs to compute score.

Old Server New Server
Old Client 🟢 🔴
New Client 🔴 🟢

/// Scoring values for a perfect play.
/// </summary>
public ScoringValues MaximumScoringValues
public Dictionary<HitResult, int> MaximumStatistics
{
get
{
if (!beatmapApplied)
throw new InvalidOperationException($"Cannot access maximum scoring values before calling {nameof(ApplyBeatmap)}.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new InvalidOperationException($"Cannot access maximum scoring values before calling {nameof(ApplyBeatmap)}.");
throw new InvalidOperationException($"Cannot access maximum statistics before calling {nameof(ApplyBeatmap)}.");

{
get
{
if (!beatmapApplied)
throw new InvalidOperationException($"Cannot access maximum scoring values before calling {nameof(ApplyBeatmap)}.");

return maximumScoringValues;
return maximumResultCounts.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing that a full copy of the dictionary was intended here (to get a fresh reference). If that was the case, you can also write

Suggested change
return maximumResultCounts.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
return new Dictionary<HitResult, int>(maximumResultCounts);

@pull-request-size pull-request-size bot added size/M and removed size/S labels Dec 12, 2022
@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 12, 2022
@peppy peppy merged commit 5800734 into ppy:master Dec 12, 2022
@smoogipoo smoogipoo deleted the spectatorstate-maximum-statistics branch September 11, 2023 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants