Skip to content

Commit 6a1beaa

Browse files
committed
Allow beatmap tagging if any score is eligible
1 parent 28fbb83 commit 6a1beaa

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
22
// See the LICENCE file in the repository root for full licence text.
33

4+
using System;
45
using System.Collections.Generic;
56
using System.Linq;
67
using System.Threading;
@@ -245,13 +246,26 @@ protected virtual IEnumerable<StatisticItem> CreateStatisticItems(ScoreInfo newS
245246

246247
// We may want to iterate on the following conditions further in the future
247248

248-
var localUserScore = AchievedScore ?? realm.Run(r =>
249-
r.GetAllLocalScoresForUser(api.LocalUser.Value.Id)
250-
.Filter($@"{nameof(ScoreInfo.BeatmapInfo)}.{nameof(BeatmapInfo.ID)} == $0", newScore.BeatmapInfo.ID)
251-
.AsEnumerable()
252-
.OrderByDescending(score => score.Ruleset.MatchesOnlineID(newScore.BeatmapInfo.Ruleset))
253-
.ThenByDescending(score => score.Rank)
254-
.FirstOrDefault());
249+
var localUserScore = AchievedScore;
250+
251+
if (localUserScore == null)
252+
{
253+
var localUserScores = realm.Run(r =>
254+
r.GetAllLocalScoresForUser(api.LocalUser.Value.Id)
255+
.Filter($@"{nameof(ScoreInfo.BeatmapInfo)}.{nameof(BeatmapInfo.ID)} == $0", newScore.BeatmapInfo.ID)
256+
.AsEnumerable()
257+
.OrderByDescending(score => score.Ruleset.MatchesOnlineID(newScore.BeatmapInfo.Ruleset))
258+
.ThenByDescending(score => score.Rank)
259+
.ToArray());
260+
261+
localUserScore = Array.Find(localUserScores, score =>
262+
{
263+
return (score.Ruleset.OnlineID == newScore.BeatmapInfo!.Ruleset.OnlineID)
264+
&& (score.Rank >= ScoreRank.C)
265+
&& (!score.Mods.Any(m => (m.Type == ModType.Conversion)
266+
|| m is not ModClassic));
267+
}) ?? localUserScores.FirstOrDefault();
268+
}
255269

256270
if (localUserScore == null)
257271
preventTaggingReason = "Play the beatmap to contribute to beatmap tags!";

0 commit comments

Comments
 (0)