fix comparing errorenous and active actions

pull/6187/head
Jens Ulferts 7 years ago
parent fedd332e10
commit 570788fa70
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 8
      app/services/custom_actions/update_work_package_service.rb

@ -67,9 +67,9 @@ class CustomActions::UpdateWorkPackageService
end
def retry_apply_actions(work_package, actions, errors)
invalid_keys = errors.keys.map { |k| k.to_s.gsub(/(_id)?$/, '_id') }
invalid_keys = errors.keys.map { |k| append_id(k) }
new_actions = actions.reject { |a| invalid_keys.include?(a.key.to_s.gsub(/(_id)?$/, '_id')) }
new_actions = actions.reject { |a| invalid_keys.include?(append_id(a.key)) }
if new_actions.any? && actions.length != new_actions.length
apply_actions(work_package, new_actions)
@ -81,4 +81,8 @@ class CustomActions::UpdateWorkPackageService
.sort_by(&:priority)
.each { |a| a.apply(work_package) }
end
def append_id(sym)
sym.to_s.chomp('_id') + '_id'
end
end

Loading…
Cancel
Save