Browse Source

Prevent duplicate rent periods v1

pull/2682/head
Manny Dinssa 2 years ago
parent
commit
bb3b4070bb
  1. 4
      app/services/merge/merge_organisations_service.rb

4
app/services/merge/merge_organisations_service.rb

@ -38,7 +38,9 @@ private
def merge_rent_periods(merging_organisation)
merging_organisation.rent_periods.each do |rent_period|
@absorbing_organisation.organisation_rent_periods << OrganisationRentPeriod.new(rent_period:) unless @absorbing_organisation.rent_periods.include?(rent_period)
unless @absorbing_organisation.organisation_rent_periods.exists?(rent_period: rent_period)
@absorbing_organisation.organisation_rent_periods << OrganisationRentPeriod.new(rent_period:)
end
end
end

Loading…
Cancel
Save