From 1232199e93146186d4e1f7ea3d3df93ad6451424 Mon Sep 17 00:00:00 2001 From: Gregor Billing Date: Tue, 29 Oct 2024 13:52:43 +0900 Subject: [PATCH] Hotfix: Proper boolean casting in CRR form --- app/controllers/admin_controller.rb | 4 +--- app/models/check_regional_records_form.rb | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 74f672b962..8938f35db6 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -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' diff --git a/app/models/check_regional_records_form.rb b/app/models/check_regional_records_form.rb index acb2421ed2..da4488ae23 100644 --- a/app/models/check_regional_records_form.rb +++ b/app/models/check_regional_records_form.rb @@ -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