Merge pull request #981 from ZmagoD/zd_SCI_2026

fixes bug with step table update [fixes SCI-2026]
This commit is contained in:
Zmago Devetak 2018-02-07 14:35:15 +01:00 committed by GitHub
commit e400514020
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -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]

View file

@ -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 |_, table|
next unless table['_destroy']
table_to_destroy = Table.find_by_id(table['id'])
table_to_destroy.report_elements.destroy_all
end
end