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

Adjust daily challenge tier thresholds to match expectations #30906

Merged
merged 5 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -37,7 +37,7 @@ protected override void LoadComplete()
AddSliderStep("weekly best", 0, 250, 1, v => update(s => s.WeeklyStreakBest = v));
AddSliderStep("top 10%", 0, 999, 0, v => update(s => s.Top10PercentPlacements = v));
AddSliderStep("top 50%", 0, 999, 0, v => update(s => s.Top50PercentPlacements = v));
AddSliderStep("playcount", 0, 999, 0, v => update(s => s.PlayCount = v));
AddSliderStep("playcount", 0, 1500, 0, v => update(s => s.PlayCount = v));
AddStep("create", () =>
{
Clear();
Expand Down Expand Up @@ -66,8 +66,8 @@ private void update(Action<APIUserDailyChallengeStatistics> change)
[Test]
public void TestPlayCountRankingTier()
{
AddAssert("1 before silver", () => DailyChallengeStatsTooltip.TierForPlayCount(30) == RankingTier.Bronze);
AddAssert("first silver", () => DailyChallengeStatsTooltip.TierForPlayCount(31) == RankingTier.Silver);
AddAssert("1 before silver", () => DailyChallengeStatsTooltip.TierForPlayCount(29) == RankingTier.Bronze);
AddAssert("first silver", () => DailyChallengeStatsTooltip.TierForPlayCount(30) == RankingTier.Silver);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,34 +138,32 @@ public void SetContent(DailyChallengeTooltipData content)
topFifty.ValueColour = colourProvider.Content2;
}

// reference: https://github.com/ppy/osu-web/blob/adf1e94754ba9625b85eba795f4a310caf169eec/resources/js/profile-page/daily-challenge.tsx#L13-L47
// reference: https://github.com/ppy/osu-web/blob/a97f156014e00ea1aa315140da60542e798a9f06/resources/js/profile-page/daily-challenge.tsx#L13-L47

// Rounding up is needed here to ensure the overlay shows the same colour as osu-web for the play count.
// This is because, for example, 31 / 3 > 10 in JavaScript because floats are used, while here it would
// get truncated to 10 with an integer division and show a lower tier.
public static RankingTier TierForPlayCount(int playCount) => TierForDaily((int)Math.Ceiling(playCount / 3.0d));
// Rounding down is needed here to ensure the overlay shows the same colour as osu-web for the play count.
frenzibyte marked this conversation as resolved.
Show resolved Hide resolved
public static RankingTier TierForPlayCount(int playCount) => TierForDaily((int)Math.Floor(playCount / 3.0d));

public static RankingTier TierForDaily(int daily)
{
if (daily > 360)
if (daily >= 360)
return RankingTier.Lustrous;

if (daily > 240)
if (daily >= 240)
return RankingTier.Radiant;

if (daily > 120)
if (daily >= 120)
return RankingTier.Rhodium;

if (daily > 60)
if (daily >= 60)
return RankingTier.Platinum;

if (daily > 30)
if (daily >= 30)
return RankingTier.Gold;

if (daily > 10)
if (daily >= 10)
return RankingTier.Silver;

if (daily > 5)
if (daily >= 5)
return RankingTier.Bronze;

return RankingTier.Iron;
Expand Down
Loading