Story#116761157 - move variable when to delete orphans to settings

This commit is contained in:
Vladimir Krylov 2016-05-27 14:31:16 +03:00
parent 35a67ce439
commit 01234e3c55
4 changed files with 4 additions and 1 deletions

View file

@ -185,7 +185,7 @@ class Contact < ActiveRecord::Base
%w(admin_contacts tech_contacts registrant).each do |type|
ver_scope << "(children->'#{type}')::jsonb <@ json_build_array(#{contact.id})::jsonb"
end
next if DomainVersion.where("created_at > ?", Time.now - 6.months).where(ver_scope.join(" OR ")).any?
next if DomainVersion.where("created_at > ?", Time.now - Setting.orphans_contacts_in_months.to_i.months).where(ver_scope.join(" OR ")).any?
next if contact.domains_present?
contact.destroy