-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Allow beatmap tagging if at least one score is eligible #36992
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
6a1beaa
fa91d23
d3fcffe
73faf88
554c333
ccf8d44
f12881c
34ddcc7
1678f7a
b05c2af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. | ||
| // See the LICENCE file in the repository root for full licence text. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Threading; | ||
|
|
@@ -245,13 +246,26 @@ protected virtual IEnumerable<StatisticItem> CreateStatisticItems(ScoreInfo newS | |
|
|
||
| // We may want to iterate on the following conditions further in the future | ||
|
|
||
| var localUserScore = AchievedScore ?? realm.Run(r => | ||
| r.GetAllLocalScoresForUser(api.LocalUser.Value.Id) | ||
| .Filter($@"{nameof(ScoreInfo.BeatmapInfo)}.{nameof(BeatmapInfo.ID)} == $0", newScore.BeatmapInfo.ID) | ||
| .AsEnumerable() | ||
| .OrderByDescending(score => score.Ruleset.MatchesOnlineID(newScore.BeatmapInfo.Ruleset)) | ||
| .ThenByDescending(score => score.Rank) | ||
| .FirstOrDefault()); | ||
| var localUserScore = AchievedScore; | ||
|
|
||
| if (localUserScore == null) | ||
|
||
| { | ||
| var localUserScores = realm.Run(r => | ||
| r.GetAllLocalScoresForUser(api.LocalUser.Value.Id) | ||
| .Filter($@"{nameof(ScoreInfo.BeatmapInfo)}.{nameof(BeatmapInfo.ID)} == $0", newScore.BeatmapInfo.ID) | ||
| .AsEnumerable() | ||
| .OrderByDescending(score => score.Ruleset.MatchesOnlineID(newScore.BeatmapInfo.Ruleset)) | ||
| .ThenByDescending(score => score.Rank) | ||
| .ToArray()); | ||
|
|
||
| localUserScore = Array.Find(localUserScores, score => | ||
| { | ||
| return (score.Ruleset.OnlineID == newScore.BeatmapInfo!.Ruleset.OnlineID) | ||
| && (score.Rank >= ScoreRank.C) | ||
|
||
| && (!score.Mods.Any(m => (m.Type == ModType.Conversion) | ||
| || m is not ModClassic)); | ||
|
||
| }) ?? localUserScores.FirstOrDefault(); | ||
| } | ||
|
|
||
| if (localUserScore == null) | ||
| preventTaggingReason = "Play the beatmap to contribute to beatmap tags!"; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.