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

Remove Passed flag from score classes #28057

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion osu.Game.Tests/Gameplay/TestSceneScoreProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ public void TestFailScore()
scoreProcessor.FailScore(score);

Assert.That(score.Rank, Is.EqualTo(ScoreRank.F));
Assert.That(score.Passed, Is.False);
Assert.That(score.Statistics.Sum(kvp => kvp.Value), Is.EqualTo(4));
Assert.That(score.MaximumStatistics.Sum(kvp => kvp.Value), Is.EqualTo(8));

Expand Down
11 changes: 5 additions & 6 deletions osu.Game.Tests/Visual/Gameplay/TestScenePlayerScoreSubmission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void TestSubmissionOnResults()
AddStep("seek to completion", () => Player.GameplayClockContainer.Seek(Player.DrawableRuleset.Objects.Last().GetEndTime()));

AddUntilStep("results displayed", () => Player.GetChildScreen() is ResultsScreen);
AddAssert("ensure passing submission", () => Player.SubmittedScore?.ScoreInfo.Passed == true);
AddAssert("ensure passing submission", () => Player.SubmittedScore?.ScoreInfo.Rank != ScoreRank.F);
}

[Test]
Expand All @@ -121,7 +121,7 @@ public void TestSubmissionForDifferentRuleset()
AddStep("seek to completion", () => Player.GameplayClockContainer.Seek(Player.DrawableRuleset.Objects.Last().GetEndTime()));

AddUntilStep("results displayed", () => Player.GetChildScreen() is ResultsScreen);
AddAssert("ensure passing submission", () => Player.SubmittedScore?.ScoreInfo.Passed == true);
AddAssert("ensure passing submission", () => Player.SubmittedScore?.ScoreInfo.Rank != ScoreRank.F);
AddAssert("submitted score has correct ruleset ID", () => Player.SubmittedScore?.ScoreInfo.Ruleset.ShortName == new TaikoRuleset().RulesetInfo.ShortName);
}

Expand All @@ -141,7 +141,7 @@ public void TestSubmissionForConvertedBeatmap()
AddStep("seek to completion", () => Player.GameplayClockContainer.Seek(Player.DrawableRuleset.Objects.Last().GetEndTime()));

AddUntilStep("results displayed", () => Player.GetChildScreen() is ResultsScreen);
AddAssert("ensure passing submission", () => Player.SubmittedScore?.ScoreInfo.Passed == true);
AddAssert("ensure passing submission", () => Player.SubmittedScore?.ScoreInfo.Rank != ScoreRank.F);
AddAssert("submitted score has correct ruleset ID", () => Player.SubmittedScore?.ScoreInfo.Ruleset.ShortName == new ManiaRuleset().RulesetInfo.ShortName);
}

Expand Down Expand Up @@ -191,7 +191,7 @@ public void TestSubmissionOnFail()
AddUntilStep("wait for fail", () => Player.GameplayState.HasFailed);

AddUntilStep("wait for submission", () => Player.SubmittedScore != null);
AddAssert("ensure failing submission", () => Player.SubmittedScore.ScoreInfo.Passed == false);
AddAssert("ensure failing submission", () => Player.SubmittedScore.ScoreInfo.Rank == ScoreRank.F);
}

[Test]
Expand Down Expand Up @@ -221,7 +221,7 @@ public void TestSubmissionOnExit()
AddStep("exit", () => Player.Exit());

AddUntilStep("wait for submission", () => Player.SubmittedScore != null);
AddAssert("ensure failing submission", () => Player.SubmittedScore.ScoreInfo.Passed == false);
AddAssert("ensure failing submission", () => Player.SubmittedScore.ScoreInfo.Rank == ScoreRank.F);
}

[Test]
Expand Down Expand Up @@ -342,7 +342,6 @@ private void prepareTestAPI(bool validToken)
MaxCombo = requestScore.MaxCombo,
Mods = requestScore.Mods,
Statistics = requestScore.Statistics,
Passed = requestScore.Passed,
EndedAt = DateTimeOffset.Now,
Position = 1
});
Expand Down
7 changes: 1 addition & 6 deletions osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -694,12 +694,7 @@ public void TestGameplayFlow()

AddUntilStep("wait for results", () => multiplayerComponents.CurrentScreen is ResultsScreen);

AddAssert("check is fail", () =>
{
var scoreInfo = ((ResultsScreen)multiplayerComponents.CurrentScreen).Score;

return scoreInfo?.Passed == false && scoreInfo.Rank == ScoreRank.F;
});
AddAssert("check is fail", () => ((ResultsScreen)multiplayerComponents.CurrentScreen).Score?.Rank == ScoreRank.F);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ private MultiplayerScore createUserResponse([NotNull] ScoreInfo userScore)
{
ID = highestScoreId,
Accuracy = userScore.Accuracy,
Passed = userScore.Passed,
Rank = userScore.Rank,
Position = real_user_position,
MaxCombo = userScore.MaxCombo,
Expand All @@ -312,7 +311,6 @@ private MultiplayerScore createUserResponse([NotNull] ScoreInfo userScore)
{
ID = getNextLowestScoreId(),
Accuracy = userScore.Accuracy,
Passed = true,
Rank = userScore.Rank,
MaxCombo = userScore.MaxCombo,
User = new APIUser
Expand All @@ -327,7 +325,6 @@ private MultiplayerScore createUserResponse([NotNull] ScoreInfo userScore)
{
ID = getNextHighestScoreId(),
Accuracy = userScore.Accuracy,
Passed = true,
Rank = userScore.Rank,
MaxCombo = userScore.MaxCombo,
User = new APIUser
Expand Down Expand Up @@ -361,7 +358,6 @@ private IndexedMultiplayerScores createIndexResponse(IndexPlaylistScoresRequest
{
ID = sort == "score_asc" ? getNextHighestScoreId() : getNextLowestScoreId(),
Accuracy = 1,
Passed = true,
Rank = ScoreRank.X,
MaxCombo = 1000,
User = new APIUser
Expand Down
5 changes: 0 additions & 5 deletions osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public class SoloScoreInfo : IScoreInfo
[JsonProperty("build_id")]
public int? BuildID { get; set; }

[JsonProperty("passed")]
public bool Passed { get; set; }
Comment on lines -30 to -31
Copy link
Collaborator

@bdach bdach May 3, 2024

Choose a reason for hiding this comment

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

Well for one thing I can certainly tell you that this cannot fly.

https://github.com/ppy/osu-web/blob/f73ea11049f333731c09ec9b1b6c1141a65a8320/app/Models/Solo/Score.php#L85-L90
https://github.com/ppy/osu-web/blob/f73ea11049f333731c09ec9b1b6c1141a65a8320/app/Models/Solo/Score.php#L123

Removing this flag will likely break things to the point wherein no submitted score will have preserved set. If this diff is to proceed we will need to wean off web from the flag first and deploy that change.

(That does not really require osu-web knowledge to test either by the way. It just requires a local environment.)

Copy link
Member Author

Choose a reason for hiding this comment

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

I want to say I miswrote the PR's description, I meant to say all consumers of SoloScoreInfo should be changed to no longer use the property...totally my bad though.

I saw those usages, and that's actually exactly why I didn't pursue this any further and left this as a task for someone more knowledgable in osu-web to change things around there (replace passed with rank != F).


[JsonProperty("total_score")]
public long TotalScore { get; set; }

Expand Down Expand Up @@ -204,7 +201,6 @@ public ScoreInfo ToScoreInfo(Mod[] mods, IBeatmapInfo? beatmap = null)
User = User ?? new APIUser { Id = UserID },
BeatmapInfo = new BeatmapInfo { OnlineID = BeatmapID },
Ruleset = new RulesetInfo { OnlineID = RulesetID },
Passed = Passed,
TotalScore = TotalScore,
LegacyTotalScore = LegacyTotalScore,
Accuracy = Accuracy,
Expand Down Expand Up @@ -243,7 +239,6 @@ public ScoreInfo ToScoreInfo(Mod[] mods, IBeatmapInfo? beatmap = null)
PP = score.PP,
MaxCombo = score.MaxCombo,
RulesetID = score.RulesetID,
Passed = score.Passed,
Mods = score.APIMods,
Statistics = score.Statistics.Where(kvp => kvp.Value != 0).ToDictionary(),
MaximumStatistics = score.MaximumStatistics.Where(kvp => kvp.Value != 0).ToDictionary(),
Expand Down
3 changes: 0 additions & 3 deletions osu.Game/Online/Rooms/MultiplayerScore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ public class MultiplayerScore
[JsonProperty("statistics")]
public Dictionary<HitResult, int> Statistics = new Dictionary<HitResult, int>();

[JsonProperty("passed")]
public bool Passed { get; set; }

[JsonProperty("ended_at")]
public DateTimeOffset EndedAt { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ private Task<PerformanceAttributes> getPerfectPerformance(ScoreInfo score, Cance
Ruleset ruleset = score.Ruleset.CreateInstance();
ScoreInfo perfectPlay = score.DeepClone();
perfectPlay.Accuracy = 1;
perfectPlay.Passed = true;

// calculate max combo
// todo: Get max combo from difficulty calculator instead when diffcalc properly supports lazer-first scores
Expand Down
2 changes: 0 additions & 2 deletions osu.Game/Rulesets/Scoring/ScoreProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,7 @@ public void FailScore(ScoreInfo score)
if (Rank.Value == ScoreRank.F)
return;

score.Passed = false;
rank.Value = ScoreRank.F;

PopulateScore(score);
}

Expand Down
3 changes: 0 additions & 3 deletions osu.Game/Scoring/ScoreInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,6 @@ public ScoreInfo DeepClone()
return clone;
}

[Ignored]
public bool Passed { get; set; } = true;

public int Combo { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ public bool HandleRequest(APIRequest request, APIUser localUser, BeatmapManager
ID = currentScoreId++,
Accuracy = 1,
EndedAt = DateTimeOffset.Now,
Passed = true,
Rank = ScoreRank.S,
MaxCombo = 1000,
TotalScore = 1000000,
Expand Down
Loading