mirror of
https://github.com/internetee/registry.git
synced 2025-05-30 01:20:04 +02:00
Stroy#119627029 - do not load legal doc if file is the same
This commit is contained in:
parent
5b946ce98a
commit
55d111ab52
1 changed files with 2 additions and 2 deletions
|
@ -42,7 +42,7 @@ namespace :legal_doc do
|
||||||
|
|
||||||
LegalDocument.where(documentable_type: "Domain", documentable_id: orig_legal.documentable_id).
|
LegalDocument.where(documentable_type: "Domain", documentable_id: orig_legal.documentable_id).
|
||||||
where(checksum: orig_legal.checksum).
|
where(checksum: orig_legal.checksum).
|
||||||
where.not(id: orig_legal.id).each do |new_legal|
|
where.not(id: orig_legal.id).where.not(path: orig_legal.path).each do |new_legal|
|
||||||
unless modified.include?(orig_legal.id)
|
unless modified.include?(orig_legal.id)
|
||||||
File.delete(new_legal.path) if File.exist?(new_legal.path)
|
File.delete(new_legal.path) if File.exist?(new_legal.path)
|
||||||
new_legal.update(path: orig_legal.path)
|
new_legal.update(path: orig_legal.path)
|
||||||
|
@ -55,7 +55,7 @@ namespace :legal_doc do
|
||||||
"object_changes->>'registrant_id'", "children->>'tech_contacts'", "children->>'admin_contacts'").flatten.uniq
|
"object_changes->>'registrant_id'", "children->>'tech_contacts'", "children->>'admin_contacts'").flatten.uniq
|
||||||
contact_ids = contact_ids.map{|id| id.is_a?(Hash) ? id["id"] : id}.compact.uniq
|
contact_ids = contact_ids.map{|id| id.is_a?(Hash) ? id["id"] : id}.compact.uniq
|
||||||
LegalDocument.where(documentable_type: "Contact", documentable_id: contact_ids).
|
LegalDocument.where(documentable_type: "Contact", documentable_id: contact_ids).
|
||||||
where(checksum: orig_legal.checksum).each do |new_legal|
|
where(checksum: orig_legal.checksum).where.not(path: orig_legal.path).each do |new_legal|
|
||||||
unless modified.include?(orig_legal.id)
|
unless modified.include?(orig_legal.id)
|
||||||
File.delete(new_legal.path) if File.exist?(new_legal.path)
|
File.delete(new_legal.path) if File.exist?(new_legal.path)
|
||||||
new_legal.update(path: orig_legal.path)
|
new_legal.update(path: orig_legal.path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue