Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Commit

Permalink
not assigning the competitor count separately like a fool
Browse files Browse the repository at this point in the history
  • Loading branch information
dunkOnIT committed Oct 29, 2024
1 parent 6830dee commit 76763e7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/services/registration_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,8 @@ def validate_update_status!
raise RegistrationError.new(:unprocessable_entity, ErrorCodes::INVALID_REQUEST_DATA) unless Registration::REGISTRATION_STATES.include?(new_status)

competitor_limit = @competition_info.competitor_limit
accepted_competitors = Registration.accepted_competitors_count(@competition_info.competition_id)
raise RegistrationError.new(:forbidden, ErrorCodes::COMPETITOR_LIMIT_REACHED) if
new_status == 'accepted' && competitor_limit > 0 && accepted_competitors == competitor_limit
new_status == 'accepted' && competitor_limit > 0 && Registration.accepted_competitors_count(@competition_info.competition_id) >= competitor_limit

raise RegistrationError.new(:forbidden, ErrorCodes::ALREADY_REGISTERED_IN_SERIES) if
new_status == 'accepted' && existing_registration_in_series?
Expand Down

0 comments on commit 76763e7

Please sign in to comment.