Improve readability

#746
This commit is contained in:
Artur Beljajev 2018-03-06 13:11:22 +02:00
parent 5319243e09
commit 046b9e96ce
6 changed files with 13 additions and 13 deletions

View file

@ -203,7 +203,7 @@ class Contact < ActiveRecord::Base
ver_scope << "(children->'#{type}')::jsonb <@ json_build_array(#{contact.id})::jsonb"
end
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.used?
next if contact.in_use?
contact.destroy
counter.next
@ -276,7 +276,7 @@ class Contact < ActiveRecord::Base
calculated.delete(Contact::OK)
calculated.delete(Contact::LINKED)
calculated << Contact::OK if calculated.empty?# && valid?
calculated << Contact::LINKED if used?
calculated << Contact::LINKED if in_use?
calculated.uniq
end
@ -344,7 +344,7 @@ class Contact < ActiveRecord::Base
# no need separate method
# should use only in transaction
def destroy_and_clean frame
if used?
if in_use?
errors.add(:domains, :exist)
return false
end
@ -540,7 +540,7 @@ class Contact < ActiveRecord::Base
Country.new(ident_country_code)
end
def used?
def in_use?
registrant_domains.any? || domain_contacts.any?
end