From b48fa3f231d815245aab8b492b85319982f2a07e Mon Sep 17 00:00:00 2001 From: zmagod Date: Mon, 5 Feb 2018 17:32:38 +0100 Subject: [PATCH 1/3] fixes bug with step table update [fixes SCI-2026] --- app/controllers/steps_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/steps_controller.rb b/app/controllers/steps_controller.rb index a6b65fb06..13389425a 100644 --- a/app/controllers/steps_controller.rb +++ b/app/controllers/steps_controller.rb @@ -547,9 +547,9 @@ class StepsController < ApplicationController # Delete the step table def delete_step_tables(params) return unless params[:tables_attributes].present? - params[:tables_attributes].each do |table| - next unless table.second['_destroy'] - table_to_destroy = Table.find_by(id: table.second['id']) + params[:tables_attributes].each do |key, table| + next unless table['_destroy'] + table_to_destroy = Table.find_by_id(table['id']) table_to_destroy.report_elements.destroy_all end end From 75cc9d11df6e16efa07f062d2074f0f186370295 Mon Sep 17 00:00:00 2001 From: zmagod Date: Tue, 6 Feb 2018 16:06:15 +0100 Subject: [PATCH 2/3] fix error on checklists --- app/controllers/concerns/steps_actions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/steps_actions.rb b/app/controllers/concerns/steps_actions.rb index 2676a2202..5f25c8709 100644 --- a/app/controllers/concerns/steps_actions.rb +++ b/app/controllers/concerns/steps_actions.rb @@ -18,7 +18,7 @@ module StepsActions new_checklists = step_params[:checklists_attributes] if new_checklists - new_checklists.each do |e| + new_checklists.to_h.each do |e| list = PreviousChecklist.new( e.second[:id].to_i, e.second[:name] From 2ad4eb34884dea677303e9354866aae5c02f4272 Mon Sep 17 00:00:00 2001 From: zmagod Date: Tue, 6 Feb 2018 16:15:10 +0100 Subject: [PATCH 3/3] fix bug with checklists --- app/controllers/steps_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/steps_controller.rb b/app/controllers/steps_controller.rb index 13389425a..d80f8ab44 100644 --- a/app/controllers/steps_controller.rb +++ b/app/controllers/steps_controller.rb @@ -547,7 +547,7 @@ class StepsController < ApplicationController # Delete the step table def delete_step_tables(params) return unless params[:tables_attributes].present? - params[:tables_attributes].each do |key, table| + params[:tables_attributes].each do |_, table| next unless table['_destroy'] table_to_destroy = Table.find_by_id(table['id']) table_to_destroy.report_elements.destroy_all