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

Update number of nominations required to qualify Beatmap #10984

Merged
merged 88 commits into from
May 31, 2024

Conversation

notbakaneko
Copy link
Collaborator

@notbakaneko notbakaneko commented Feb 8, 2024

  • Updated required nominations
  • Moved the nomination logic out to its own class
  • Removed the try-catch dance on nominate()
  • went through the nomination and qualification tests to make sure they were passing/failing on the things they were supposed to be
  • the expectExceptionCallable wrapper is so that we can run additional assertions after the test throws to make sure it didn't do the thing it wasn't supposed to do.
  • withHypes() test factory isn't used by any test, it's for quickly seeding a Beatmapset with necessary number of hypes for nomination.
  • throws an error if nominating puts the mapset in an invalid state that can't be qualified (e.g. main ruleset changing and making the number of nominations invalid)
  • how long has this been using the wrong translation key 👀
  • we're just going to deal with it when it happens/reset the nominations. might be a problem with existing nominations since they might fail the nomination count check 🤔
    • there's appears to be only 1 beatmapset with a limited nomination that might fail the check so maybe it's better to handle it manually when it arises instead of coding in an exception for it.
  • Main ruleset probably needs to be stored somewhere, constantly re-querying everything to get the summary counts for BeatmapPanel is probably not a good idea...
  • remove ability to do legacy nominations

I'm still not quite satisfied with the number of repeated things the tests do each time, but we've had questions in the past about notifications, etc not being sent due to a user setting, when they have been dispatched.

  • updating logic if 1 and 2 not met
    Probationary BNs cannot be the only nomination on their ruleset (i.e. can only nominate the main ruleset)

The new rules for nomination on hybrid sets are:

2 nominations required for the main ruleset and 1 on every other ruleset.
There must be one full nominator on every ruleset.

  1. The main ruleset is the one with the most difficulties
  2. If the number of difficulties are the same, then the one with the most diffs by the host if the main ruleset.
    If 1 and 2 do not result in a clear main ruleset, then any ruleset that satisfies the previous criteria is used.

@notbakaneko notbakaneko self-assigned this Feb 8, 2024
@notbakaneko notbakaneko force-pushed the feature/nomination-updates-rebased branch from e2d5e6b to 21ce02e Compare February 9, 2024 07:58
@nanaya nanaya changed the title Update number of nominations required to qualify Beamtmap Update number of nominations required to qualify Beatmap Feb 9, 2024
@notbakaneko notbakaneko marked this pull request as draft March 8, 2024 14:37
@notbakaneko
Copy link
Collaborator Author

(draft while I fix some missing stuff + rebase)

@notbakaneko notbakaneko force-pushed the feature/nomination-updates-rebased branch from cce3066 to 3657218 Compare March 8, 2024 14:49
app/Libraries/Beatmapset/NominateBeatmapset.php Outdated Show resolved Hide resolved
resources/js/beatmap-discussions/nominator.tsx Outdated Show resolved Hide resolved
}

public function testLimitedBNGQualifyingNominationNATNominated()
public function testNominateMainRulsetInvariant()
Copy link
Collaborator

Choose a reason for hiding this comment

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

rul...set :thonk:

$this->assertFalse($result['result']);
$this->assertSame($result['message'], osu_trans('beatmapsets.nominate.full_bn_required'));
$this->assertTrue($beatmapset->fresh()->isPending());
$beatmapset->nominate($nominator, ['taiko']);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this test fails if it's $beatmapset->fresh()->nominate(...) instead. Replacing the refresh with $beatmapset = $beatmapset->fresh() doesn't help so the bssProcessQueues() maybe somehow do something to the nominate function? 🤷

Also the nomination throws this error (not sure if it's tested somewhere in this file):

  • map with taiko and fruits being eligible
  • existing nominations (in order):
    1. fruits (bn)
    2. fruits (limited bn)
  • trying to nominate (qualify) taiko (bn)

(I copied this test and noticed it doesn't fail unless I call fresh beforehand just like in this test)

Copy link
Collaborator

@nanaya nanaya May 30, 2024

Choose a reason for hiding this comment

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

oh it was just the model used for assertion was outdated 🤔 still no idea why I'm getting that nomination error above though

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removing the bssProcessQueues() check doesn't have any affect 🤔


// First mode with more nominations that others becomes main mode.
// Implicity implies that limited BN nominations becomes main mode.
$nominations = $this->beatmapset->beatmapsetNominations()->current()->get();
Copy link
Collaborator

Choose a reason for hiding this comment

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

looks like this needs an explicit order. In my dev db the new row somehow is returned first and messed things up

Copy link
Collaborator

Choose a reason for hiding this comment

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

either that or the logic needs some rework to not immediately finish on the first ruleset with single nomination...

nanaya
nanaya previously approved these changes May 30, 2024
Copy link
Collaborator

@nanaya nanaya left a comment

Choose a reason for hiding this comment

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

seems working (inb4 things fall over right after deploy)

@nanaya nanaya enabled auto-merge May 31, 2024 09:26
@nanaya nanaya merged commit 1dc0461 into ppy:master May 31, 2024
3 checks passed
@notbakaneko notbakaneko deleted the feature/nomination-updates-rebased branch June 4, 2024 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants