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

Fix stable scores showing with faded out pp display due to classic mod presence #27877

Merged
merged 2 commits into from
Apr 15, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,21 @@ public void TestPPShownAsProvisionalWhenUnrankedModsArePresent()
});
}

[Test]
public void TestPPNotShownAsProvisionalIfClassicModIsPresentDueToLegacyScore()
{
AddStep("show example score", () =>
{
var score = TestResources.CreateTestScoreInfo(createTestBeatmap(new RealmUser()));
score.PP = 400;
score.Mods = score.Mods.Append(new OsuModClassic()).ToArray();
score.IsLegacyScore = true;
showPanel(score);
});

AddAssert("pp display faded out", () => this.ChildrenOfType<PerformanceStatistic>().Single().Alpha == 1);
}

[Test]
public void TestWithDefaultDate()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#nullable disable

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -17,6 +18,7 @@
using osu.Game.Resources.Localisation.Web;
using osu.Game.Scoring;
using osu.Game.Localisation;
using osu.Game.Rulesets.Mods;

namespace osu.Game.Screens.Ranking.Expanded.Statistics
{
Expand Down Expand Up @@ -74,7 +76,7 @@ private void setPerformanceValue(ScoreInfo scoreInfo, double? pp)
Alpha = 0.5f;
TooltipText = ResultsScreenStrings.NoPPForUnrankedBeatmaps;
}
else if (scoreInfo.Mods.Any(m => !m.Ranked))
else if (hasUnrankedMods(scoreInfo))
{
Alpha = 0.5f;
TooltipText = ResultsScreenStrings.NoPPForUnrankedMods;
Expand All @@ -87,6 +89,16 @@ private void setPerformanceValue(ScoreInfo scoreInfo, double? pp)
}
}

private static bool hasUnrankedMods(ScoreInfo scoreInfo)
{
IEnumerable<Mod> modsToCheck = scoreInfo.Mods;

if (scoreInfo.IsLegacyScore)
modsToCheck = modsToCheck.Where(m => m is not ModClassic);

return modsToCheck.Any(m => !m.Ranked);
}

public override void Appear()
{
base.Appear();
Expand Down
Loading