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

Allow organizers to approve registrations when there is no competitor limit #722

Merged
merged 4 commits into from
Oct 29, 2024

Conversation

dunkOnIT
Copy link
Collaborator

This fixes an issue reported for TexasFMCChampionship2024

@@ -173,7 +173,8 @@ def validate_update_status!

raise RegistrationError.new(:unprocessable_entity, ErrorCodes::INVALID_REQUEST_DATA) unless Registration::REGISTRATION_STATES.include?(new_status)
raise RegistrationError.new(:forbidden, ErrorCodes::COMPETITOR_LIMIT_REACHED) if
new_status == 'accepted' && Registration.accepted_competitors_count(@competition_info.competition_id) == @competition_info.competitor_limit
new_status == 'accepted' && Registration.accepted_competitors_count(@competition_info.competition_id) == @competition_info.competitor_limit &&
@competition_info.competitor_limit != 0
Copy link
Member

Choose a reason for hiding this comment

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

  1. competitor_limit > 0
  2. You can put this check first, because the (relatively) expensive Registration.accepted_competitors_count doesn't even need to be run if there is no competitor limit

@dunkOnIT dunkOnIT merged commit 13704e8 into thewca:main Oct 29, 2024
1 check passed
@dunkOnIT dunkOnIT deleted the fix/no-competitor-limit branch October 29, 2024 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants