Allow beatmap tagging if at least one score is eligible#36992
Allow beatmap tagging if at least one score is eligible#36992imvanni wants to merge 10 commits intoppy:masterfrom
Conversation
bdach
left a comment
There was a problem hiding this comment.
- Tests would go a long way here, see
TestSceneStatisticsPanel - There's also code quality inspections here but I'll let CI handle that one
| var localUserScore = AchievedScore; | ||
|
|
||
| if (localUserScore == null) |
There was a problem hiding this comment.
I'm not sure this makes sense anymore? If the point is to allow tagging if any local score matches, then there's little reason to still prefer the latest set score if the user has already proven themselves capable to tag.
| && (!score.Mods.Any(m => (m.Type == ModType.Conversion) | ||
| || m is not ModClassic)); |
There was a problem hiding this comment.
I'm not even sure this is correctly transcribed from code lower down. m.Type == ModTypeConversion || m is not ModClassic is not the same thing as (m.Type == ModType.Conversion) && !(m is ModClassic).
This should either be && in both places or the first should be correctly negated as per generalized De Morgan's laws.
In general there's kind of little reason why this needs to be duplicated like this. I imagine that you could split a method like getReasonForPreventingTagging(ScoreInfo) and then use it here instead in a getReasonForPreventingTagging(score) == null manner.
|
Oh yeah, apologies for the spam actions. |
|
As for the tests... For the one I was supposed to add here, I repurposed While I was here I added the missing ones I was supposed to add back in #36684. |
| .OrderByDescending(score => score.Ruleset.MatchesOnlineID(newScore.BeatmapInfo.Ruleset)) | ||
| .ThenByDescending(score => score.Rank) | ||
| .FirstOrDefault()); | ||
| .ThenBy(score => score.Rank) |
There was a problem hiding this comment.
Ordering by score descending then by rank ascending doesn't make sense. If you want to start with the worst scores it should be score ascending then rank ascending.
There was a problem hiding this comment.
I've actually overlooked ordering by TotalScore. Should I just forget about ordering by Rank and sort only using Ruleset and Score then?
.AsEnumerable()
.OrderByDescending(score => score.Ruleset.MatchesOnlineID(newScore.BeatmapInfo.Ruleset))
.ThenBy(score => score.TotalScore)Or would we do both:
.OrderByDescending(score => score.Ruleset.MatchesOnlineID(newScore.BeatmapInfo.Ruleset))
.ThenBy(score => score.TotalScore)
.ThenBy(score => score.Rank)
Closes #36910.
Instead of picking the top score to see if it's eligible for tagging, find at least one score that matches all criteria for it.
This process is only done when trying to do so on the beatmap list (as in, not after playing) because to be fair I don't think it's necessary, unless we decide otherwise. This really just covers the very edge cases where you may have a better score with a Mirror mod for example.