Skip to content

Commit

Permalink
Hotfix: Proper boolean casting in CRR form
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorbg committed Oct 29, 2024
1 parent 78e383a commit 1232199
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 1 addition & 3 deletions app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,10 @@ def do_generate_public_export
end

def check_regional_records
refresh_index_param = params[:refresh_index] || nil

@check_records_request = CheckRegionalRecordsForm.new(
competition_id: params[:competition_id] || nil,
event_id: params[:event_id] || nil,
refresh_index: ActiveRecord::Type::Boolean.new.cast(refresh_index_param) || false,
refresh_index: params[:refresh_index] || nil,
)

@cad_timestamp = ComputeAuxiliaryData.successful_start_date&.to_fs || 'never'
Expand Down
6 changes: 5 additions & 1 deletion app/models/check_regional_records_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ def check_event_id
self.event_id == 'all' ? nil : self.event_id
end

def refresh_index?
ActiveRecord::Type::Boolean.new.cast(self.refresh_index) || false
end

def run_check
if self.refresh_index && self.competition_id.present?
if self.refresh_index? && self.competition_id.present?
CheckRegionalRecords.add_to_lookup_table(self.competition_id)
end

Expand Down

0 comments on commit 1232199

Please sign in to comment.