Browse Source

feat: remove old_visible_id from post merge schemes/locations so they aren't searchable in bulk upload

pull/2013/head
natdeanlewissoftwire 3 years ago
parent
commit
7eaaa10bf3
  1. 4
      app/services/merge/merge_organisations_service.rb

4
app/services/merge/merge_organisations_service.rb

@ -68,9 +68,9 @@ private
merging_organisation.owned_schemes.each do |scheme|
next if scheme.deactivated?
new_scheme = Scheme.create!(scheme.attributes.except("id", "owning_organisation_id", "old_id").merge(owning_organisation: @absorbing_organisation))
new_scheme = Scheme.create!(scheme.attributes.except("id", "owning_organisation_id", "old_id", "old_visible_id").merge(owning_organisation: @absorbing_organisation))
scheme.locations.each do |location|
new_scheme.locations << Location.new(location.attributes.except("id", "scheme_id", "old_id")) unless location.deactivated?
new_scheme.locations << Location.new(location.attributes.except("id", "scheme_id", "old_id", "old_visible_id")) unless location.deactivated?
end
@merged_schemes[merging_organisation.name] << { name: new_scheme.service_name, code: new_scheme.id }
SchemeDeactivationPeriod.create!(scheme:, deactivation_date: @merge_date)

Loading…
Cancel
Save