Skip to content

Commit

Permalink
Update preservica sync logic (#1251)
Browse files Browse the repository at this point in the history
* Add spec to confirm behavior of update

* Modify call in update process

* Rubocop

* Update preservica_update_spec.rb

Update expectations

* rubocop again

* Force logic to always update
  • Loading branch information
K8Sewell authored Aug 24, 2023
1 parent 5f4fb12 commit e5c603f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions app/models/batch_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -514,12 +514,13 @@ def sync_from_preservica

# SYNC IMAGES FROM PRESERVICA
def sync_images_preservica(local_children_hash, preservica_children_hash, parent_object)
if local_children_hash != preservica_children_hash
setup_for_background_jobs(parent_object, parent_object.source_name)
parent_object.sync_from_preservica(local_children_hash, preservica_children_hash)
else
batch_processing_event("Child object count and order is the same. No update needed.", "Skipped Row")
end
# always update
# if local_children_hash != preservica_children_hash
setup_for_background_jobs(parent_object, parent_object.source_name)
parent_object.sync_from_preservica(local_children_hash, preservica_children_hash)
# else
# batch_processing_event("Child object count and order is the same. No update needed.", "Skipped Row")
# end
end

# rubocop:disable Metrics/MethodLength
Expand Down
3 changes: 2 additions & 1 deletion spec/models/preservica/preservica_sync_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@
File.delete("spec/fixtures/images/access_masters/00/06/20/00/00/00/200000006.tif") if File.exist?("spec/fixtures/images/access_masters/00/06/20/00/00/00/200000006.tif")
end

it 'can recognize when child object count and order is the same' do
# always update
xit 'can recognize when child object count and order is the same' do
File.delete("spec/fixtures/images/access_masters/00/01/20/00/00/00/200000001.tif") if File.exist?("spec/fixtures/images/access_masters/00/01/20/00/00/00/200000001.tif")
File.delete("spec/fixtures/images/access_masters/00/02/20/00/00/00/200000002.tif") if File.exist?("spec/fixtures/images/access_masters/00/02/20/00/00/00/200000002.tif")
File.delete("spec/fixtures/images/access_masters/00/03/20/00/00/00/200000003.tif") if File.exist?("spec/fixtures/images/access_masters/00/03/20/00/00/00/200000003.tif")
Expand Down

0 comments on commit e5c603f

Please sign in to comment.