Skip to content

Allow beatmap tagging if at least one score is eligible#36992

Open
imvanni wants to merge 10 commits intoppy:masterfrom
imvanni:tagging-use-available-score
Open

Allow beatmap tagging if at least one score is eligible#36992
imvanni wants to merge 10 commits intoppy:masterfrom
imvanni:tagging-use-available-score

Conversation

@imvanni
Copy link
Contributor

@imvanni imvanni commented Mar 15, 2026

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.

Copy link
Collaborator

@bdach bdach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Tests would go a long way here, see TestSceneStatisticsPanel
  • There's also code quality inspections here but I'll let CI handle that one

Comment on lines +249 to +251
var localUserScore = AchievedScore;

if (localUserScore == null)
Copy link
Collaborator

@bdach bdach Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +265 to +266
&& (!score.Mods.Any(m => (m.Type == ModType.Conversion)
|| m is not ModClassic));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pull-request-size pull-request-size bot added size/L and removed size/S labels Mar 19, 2026
@imvanni
Copy link
Contributor Author

imvanni commented Mar 19, 2026

Oh yeah, apologies for the spam actions. InspectCode.sh doesn't seem to work on my end for whatever reason.

@imvanni
Copy link
Contributor Author

imvanni commented Mar 19, 2026

As for the tests... For the one I was supposed to add here, I repurposed TaggingInteractionWithLocalScores, except I stashed the "eligible" score at the bottom.

While I was here I added the missing ones I was supposed to add back in #36684.

@imvanni imvanni requested a review from bdach March 20, 2026 11:57
popOutSample = audio.Samples.Get(@"Results/statistics-panel-pop-out");
}

private string? getReasonFromPreventingTagging(ScoreInfo newScore, ScoreInfo? localScore)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this method accept two scores? That should not be necessary. localScore seems like it shouldn't be here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was for comparing rulesets. But yeah, realized it's not required. Just passing the expected ruleset OnlineID should be enough, yes?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to think that even passing ruleset ID explicitly would be gratuitous and all you need is newScore.Beatmap.Ruleset.OnlineID, but I could be wrong on that. Needs checking.

Copy link
Contributor Author

@imvanni imvanni Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'd mean putting the method inside the IEnumerable which renders the existence of said method useless.

If anything I'd convert it to something like

if (localUserScores.Length == 0)
    localUserScores.Append(AchievedScore);

foreach (ScoreInfo score in localUserScores)
{
    preventTaggingReason = ...;
    if (preventTaggingReason == null)
        break;
}

Except I believe that the first step is both incorrect and unnecessary. Incorrect since it'll take any score, even if it's not local, and unnecessary, because the locally achieved score should've been written to the Realm already, meaning the count isn't zero. Correct me though. It existed while I was writing the tests, because it would always yield a "not played" status, but then figured it's entirely wrong.

@imvanni imvanni requested a review from bdach March 23, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to tag beatmap despite having a score without conversion mods

2 participants