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

Rename registration_opened? to registration_open? #9709

Merged
merged 15 commits into from
Aug 7, 2024
Merged
2 changes: 1 addition & 1 deletion app/controllers/api/v0/competitions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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],
}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/competitions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions app/models/competition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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?
dunkOnIT marked this conversation as resolved.
Show resolved Hide resolved
end

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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],
}
Expand Down
4 changes: 2 additions & 2 deletions app/models/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion app/views/competitions/_nav.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
icon: "align left",
}
end
if !EnvConfig.WCA_LIVE_SITE? && current_user&.can_manage_competition?(@competition) && [email protected]_new_registration_service? && !@competition.registration_opened?
if !EnvConfig.WCA_LIVE_SITE? && current_user&.can_manage_competition?(@competition) && [email protected]_new_registration_service? && !@competition.registration_currently_open?
nav_items << {
text: t('.menu.enable_v2'),
path: enable_v2_path(@competition),
Expand Down
2 changes: 1 addition & 1 deletion app/views/registrations/register.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<%= t 'registrations.contact_organizer' %>
<% end %>
<hr/>
<% 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down