mirror of
https://github.com/internetee/registry.git
synced 2025-08-11 12:09:34 +02:00
Fixed codeclimate issues
This commit is contained in:
parent
b2bfc94121
commit
140e5dc22e
2 changed files with 10 additions and 8 deletions
|
@ -40,6 +40,7 @@ class RegistrantUser < User
|
||||||
{ result: false, counter: 0 }
|
{ result: false, counter: 0 }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop:disable Metrics/MethodLength
|
||||||
def update_contacts
|
def update_contacts
|
||||||
user = self
|
user = self
|
||||||
contacts = []
|
contacts = []
|
||||||
|
@ -47,7 +48,7 @@ class RegistrantUser < User
|
||||||
c.write_attribute(:name, user.username)
|
c.write_attribute(:name, user.username)
|
||||||
end)
|
end)
|
||||||
companies.each do |company|
|
companies.each do |company|
|
||||||
contacts.concat(Contact.with_different_company_name(company).each do |c|
|
contacts.concat(Contact.with_different_company_name(company).each do |c|
|
||||||
c.write_attribute(:name, company.company_name)
|
c.write_attribute(:name, company.company_name)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
@ -55,9 +56,9 @@ class RegistrantUser < User
|
||||||
return [] if contacts.blank?
|
return [] if contacts.blank?
|
||||||
|
|
||||||
group_and_bulk_update(contacts)
|
group_and_bulk_update(contacts)
|
||||||
|
|
||||||
contacts
|
contacts
|
||||||
end
|
end
|
||||||
|
# rubocop:enable Metrics/MethodLength
|
||||||
|
|
||||||
def contacts(representable: true)
|
def contacts(representable: true)
|
||||||
Contact.registrant_user_contacts(self, representable: representable)
|
Contact.registrant_user_contacts(self, representable: representable)
|
||||||
|
@ -138,8 +139,7 @@ class RegistrantUser < User
|
||||||
private
|
private
|
||||||
|
|
||||||
def group_and_bulk_update(contacts)
|
def group_and_bulk_update(contacts)
|
||||||
grouped_contacts = contacts.group_by(&:registrar_id)
|
contacts.group_by(&:registrar_id).each do |registrar_id, reg_contacts|
|
||||||
grouped_contacts.each do |registrar_id, reg_contacts|
|
|
||||||
bulk_action, action = actions.create!(operation: :bulk_update) if reg_contacts.size > 1
|
bulk_action, action = actions.create!(operation: :bulk_update) if reg_contacts.size > 1
|
||||||
reg_contacts.each do |c|
|
reg_contacts.each do |c|
|
||||||
if c.save(validate: false)
|
if c.save(validate: false)
|
||||||
|
|
|
@ -8,10 +8,12 @@ builder.extension do
|
||||||
builder.tag!('changePoll:date', obj.created_at.utc.xmlschema)
|
builder.tag!('changePoll:date', obj.created_at.utc.xmlschema)
|
||||||
builder.tag!('changePoll:svTRID', obj.id)
|
builder.tag!('changePoll:svTRID', obj.id)
|
||||||
builder.tag!('changePoll:who', obj.user)
|
builder.tag!('changePoll:who', obj.user)
|
||||||
builder.tag!(
|
if obj.bulk_action?
|
||||||
'changePoll:reason',
|
builder.tag!(
|
||||||
'Auto-update according to official data'
|
'changePoll:reason',
|
||||||
) if obj.bulk_action?
|
'Auto-update according to official data'
|
||||||
|
)
|
||||||
|
end
|
||||||
when 'state'
|
when 'state'
|
||||||
builder.tag!('changePoll:operation', obj)
|
builder.tag!('changePoll:operation', obj)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue