diff --git a/app/controllers/api/v0/competitions_controller.rb b/app/controllers/api/v0/competitions_controller.rb index adde2c3256..66fd30a0e4 100644 --- a/app/controllers/api/v0/competitions_controller.rb +++ b/app/controllers/api/v0/competitions_controller.rb @@ -49,7 +49,7 @@ def show allow_registration_without_qualification refund_policy_percent use_wca_registration guests_per_registration_limit venue contact force_comment_in_registration use_wca_registration external_registration_page guests_entry_fee_lowest_denomination guest_entry_status information events_per_registration_limit], - methods: %w[url website short_name city venue_address venue_details latitude_degrees longitude_degrees country_iso2 event_ids registration_opened? + methods: %w[url website short_name city venue_address venue_details latitude_degrees longitude_degrees country_iso2 event_ids registration_currently_open? main_event_id number_of_bookmarks using_payment_integrations? uses_qualification? uses_cutoff? competition_series_ids], include: %w[delegates organizers tabs], } diff --git a/app/controllers/competitions_controller.rb b/app/controllers/competitions_controller.rb index e691591752..d93530106b 100644 --- a/app/controllers/competitions_controller.rb +++ b/app/controllers/competitions_controller.rb @@ -591,7 +591,7 @@ def unbookmark # Enables the New Registration Service for a Competition def enable_v2 @competition = competition_from_params - if EnvConfig.WCA_LIVE_SITE? || @competition.registration_opened? + if EnvConfig.WCA_LIVE_SITE? || @competition.registration_currently_open? flash.now[:danger] = t('competitions.messages.cannot_activate_v2') return redirect_to competition_path(@competition) end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 4003d74df3..3308d91f58 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -745,7 +745,7 @@ def refund_payment def create @competition = competition_from_params - unless @competition.registration_opened? || @competition.user_can_pre_register?(current_user) + unless @competition.registration_currently_open? || @competition.user_can_pre_register?(current_user) flash[:danger] = "You cannot register for this competition, registration is closed" redirect_to competition_path(@competition) return diff --git a/app/models/competition.rb b/app/models/competition.rb index a8ad206fbd..4b22b8f087 100644 --- a/app/models/competition.rb +++ b/app/models/competition.rb @@ -476,7 +476,7 @@ def warnings_for(user) end end - if self.registration_full? && self.registration_opened? + if self.registration_full? && self.registration_currently_open? warnings[:waiting_list] = registration_full_message end @@ -725,7 +725,7 @@ def uses_new_registration_service? end def should_render_register_v2?(user) - uses_new_registration_service? && user.cannot_register_for_competition_reasons(self).empty? && (registration_opened? || user_can_pre_register?(user)) + uses_new_registration_service? && user.cannot_register_for_competition_reasons(self).empty? && (registration_currently_open? || user_can_pre_register?(user)) end before_validation :unpack_delegate_organizer_ids @@ -953,7 +953,7 @@ def can_edit_registration_fees? true end - def registration_opened? + def registration_currently_open? use_wca_registration? && !cancelled? && !registration_not_yet_opened? && !registration_past? end @@ -1180,7 +1180,8 @@ def registration_delete_after_acceptance_allowed? errors.add(:refund_policy_limit_date, I18n.t('competitions.errors.refund_date_after_start')) end - if registration_period_required? && registration_open? && registration_close? && (registration_open >= start_date || registration_close >= start_date) + if registration_period_required? && registration_open.present? && registration_close.present? && + (registration_open >= start_date || registration_close >= start_date) errors.add(:registration_close, I18n.t('competitions.errors.registration_period_after_start')) end end @@ -1372,7 +1373,7 @@ def can_be_cancelled? end def orga_can_close_reg_full_limit? - registration_full? && registration_opened? + registration_full? && registration_currently_open? end def display_name(short: false) @@ -1838,7 +1839,7 @@ def to_competition_info allow_registration_without_qualification refund_policy_percent use_wca_registration guests_per_registration_limit venue contact force_comment_in_registration use_wca_registration external_registration_page guests_entry_fee_lowest_denomination guest_entry_status information events_per_registration_limit], - methods: %w[url website short_name city venue_address venue_details latitude_degrees longitude_degrees country_iso2 event_ids registration_opened? + methods: %w[url website short_name city venue_address venue_details latitude_degrees longitude_degrees country_iso2 event_ids registration_currently_open? main_event_id number_of_bookmarks using_payment_integrations? uses_qualification? uses_cutoff? competition_series_ids registration_full?], include: %w[delegates organizers], } diff --git a/app/models/registration.rb b/app/models/registration.rb index 1f18976fde..6f4cfce8f3 100644 --- a/app/models/registration.rb +++ b/app/models/registration.rb @@ -144,11 +144,11 @@ def to_be_paid_through_wca? end def show_payment_form? - competition.registration_opened? && to_be_paid_through_wca? + competition.registration_currently_open? && to_be_paid_through_wca? end def show_details?(user) - (competition.registration_opened? || !(new_or_deleted?)) || (competition.user_can_pre_register?(user)) + (competition.registration_currently_open? || !(new_or_deleted?)) || (competition.user_can_pre_register?(user)) end def record_payment( diff --git a/app/views/competitions/_nav.html.erb b/app/views/competitions/_nav.html.erb index aaad77e078..2d7b67f9c4 100644 --- a/app/views/competitions/_nav.html.erb +++ b/app/views/competitions/_nav.html.erb @@ -126,7 +126,7 @@ icon: "align left", } end - if !EnvConfig.WCA_LIVE_SITE? && current_user&.can_manage_competition?(@competition) && !@competition.uses_new_registration_service? && !@competition.registration_opened? + if !EnvConfig.WCA_LIVE_SITE? && current_user&.can_manage_competition?(@competition) && !@competition.uses_new_registration_service? && !@competition.registration_currently_open? nav_items << { text: t('.menu.enable_v2'), path: enable_v2_path(@competition), diff --git a/app/views/registrations/register.html.erb b/app/views/registrations/register.html.erb index c12ae43533..c492cb988d 100644 --- a/app/views/registrations/register.html.erb +++ b/app/views/registrations/register.html.erb @@ -53,7 +53,7 @@ <%= t 'registrations.contact_organizer' %> <% end %>
- <% elsif @competition.registration_opened? %> + <% elsif @competition.registration_currently_open? %> <% unless user_may_register %> <%= alert :danger do %> <%= t 'registrations.please_fix_profile_html', comp: @competition.name, diff --git a/app/webpacker/components/RegistrationsV2/Register/CompetingStep.jsx b/app/webpacker/components/RegistrationsV2/Register/CompetingStep.jsx index 3176fcbb04..1f40b23278 100644 --- a/app/webpacker/components/RegistrationsV2/Register/CompetingStep.jsx +++ b/app/webpacker/components/RegistrationsV2/Register/CompetingStep.jsx @@ -29,7 +29,7 @@ const maxCommentLength = 240; const potentialWarnings = (competitionInfo) => { const warnings = []; // Organizer Pre Registration - if (!competitionInfo['registration_opened?']) { + if (!competitionInfo['registration_currently_open?']) { warnings.push(i18n.t('competitions.registration_v2.register.early_registration')); } // Favourites Competition