bulk_ops 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bulk_ops/operation.rb +6 -0
- data/lib/bulk_ops/relationship.rb +4 -6
- data/lib/bulk_ops/version.rb +1 -1
- data/lib/bulk_ops/work_job.rb +1 -8
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 58a1fcfbb6f75f1a90103383bf9d77afc7912db5e837d57e7f514a0d2620646b
         | 
| 4 | 
            +
              data.tar.gz: c6e74c188710b832d14a62c8622c7d4b116b3fc24069bce83ef044f3c1de7bf7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 629745639d8de5bdb9ced3eaa7473721d33ed87beb2d6e7af100306e5177545ee65419ee172a7eaa900e2e94434437f6236209f6fe00c5b26dd4b21975096687
         | 
| 7 | 
            +
              data.tar.gz: 38ecec91afaccc17de448fd42d6aab6d295dab4e40a25d786dd57c77af642e978bfdb0f6805341e57494a135a04c8fdd2dc3da4020fe4a2cc9681cec8d7d4e16
         | 
    
        data/lib/bulk_ops/operation.rb
    CHANGED
    
    | @@ -140,6 +140,12 @@ module BulkOps | |
| 140 140 |  | 
| 141 141 | 
             
                def check_if_finished
         | 
| 142 142 | 
             
                  return unless stage == "running" && !busy?
         | 
| 143 | 
            +
             | 
| 144 | 
            +
                  # Attempt to resolve each dangling (objectless) relationships
         | 
| 145 | 
            +
                  BulkOps::Relationship.where(:status => "pending").each do |relationship|
         | 
| 146 | 
            +
                    relationship.resolve!
         | 
| 147 | 
            +
                  end
         | 
| 148 | 
            +
             | 
| 143 149 | 
             
                  update(stage: accumulated_errors.blank? ? "complete" : "errors" )
         | 
| 144 150 | 
             
                  report_errors!
         | 
| 145 151 | 
             
                  lift_holds
         | 
| @@ -13,7 +13,6 @@ class BulkOps::Relationship < ActiveRecord::Base | |
| 13 13 | 
             
              end
         | 
| 14 14 |  | 
| 15 15 | 
             
              def findObject
         | 
| 16 | 
            -
                work_type = (relationship_type.downcase == "collection") ? "Collection" : work_proxy.work_type
         | 
| 17 16 | 
             
                case identifier_type
         | 
| 18 17 | 
             
                when "id"
         | 
| 19 18 | 
             
                  begin
         | 
| @@ -29,7 +28,7 @@ class BulkOps::Relationship < ActiveRecord::Base | |
| 29 28 | 
             
                                                                        params: { fq: query, rows: 100})["response"]["docs"].first
         | 
| 30 29 | 
             
                  if objects.present?
         | 
| 31 30 | 
             
                    return ActiveFedora::Base.find(objects.first["id"])
         | 
| 32 | 
            -
                  elsif  | 
| 31 | 
            +
                  elsif relationship_type.downcase == "collection"
         | 
| 33 32 | 
             
                    return Collection.create(title: [object_identifier])
         | 
| 34 33 | 
             
                  else
         | 
| 35 34 | 
             
                    return false
         | 
| @@ -40,19 +39,18 @@ class BulkOps::Relationship < ActiveRecord::Base | |
| 40 39 | 
             
                  return false if objects.blank?
         | 
| 41 40 | 
             
                  return ActiveFedora::Base.find(objects.first["id"])
         | 
| 42 41 | 
             
                when "row"
         | 
| 43 | 
            -
                  object_proxy = WorkProxy.find_by(operation_id: work_proxy.operation.id, 
         | 
| 44 | 
            -
             | 
| 42 | 
            +
                  object_proxy = BulkOps::WorkProxy.find_by(operation_id: work_proxy.operation.id, 
         | 
| 43 | 
            +
                                                            row_number: (object_identifier.to_i - 2))
         | 
| 45 44 | 
             
                  ActiveFedora::Base.find(object_proxy.work_id)
         | 
| 46 45 | 
             
                end
         | 
| 47 46 | 
             
              end
         | 
| 48 47 |  | 
| 49 | 
            -
              def resolve! | 
| 48 | 
            +
              def resolve!
         | 
| 50 49 | 
             
                unless subject = work_proxy.work and object = self.findObject
         | 
| 51 50 | 
             
                  wait!
         | 
| 52 51 | 
             
                  return
         | 
| 53 52 | 
             
                end
         | 
| 54 53 | 
             
                implement_relationship! relationship_type, subject, object
         | 
| 55 | 
            -
             | 
| 56 54 | 
             
              end
         | 
| 57 55 |  | 
| 58 56 | 
             
              def implement_relationship!(type,subject,object)
         | 
    
        data/lib/bulk_ops/version.rb
    CHANGED
    
    
    
        data/lib/bulk_ops/work_job.rb
    CHANGED
    
    | @@ -23,12 +23,6 @@ class BulkOps::WorkJob < ActiveJob::Base | |
| 23 23 | 
             
                  relationship.resolve!
         | 
| 24 24 | 
             
                end
         | 
| 25 25 |  | 
| 26 | 
            -
                # Attempt to resolve each dangling (objectless) relationships using   
         | 
| 27 | 
            -
                # this work as an object
         | 
| 28 | 
            -
                BulkOps::Relationship.where(:status => "objectless").each do |relationship|
         | 
| 29 | 
            -
                  relationship.resolve! @work.id
         | 
| 30 | 
            -
                end
         | 
| 31 | 
            -
             | 
| 32 26 | 
             
                # Delete any UploadedFiles. These take up tons of unnecessary disk space.
         | 
| 33 27 | 
             
                @work.file_sets.each do |fileset|
         | 
| 34 28 | 
             
                  if uf = Hyrax::UploadedFile.find_by(file: fileset.label)
         | 
| @@ -40,8 +34,7 @@ class BulkOps::WorkJob < ActiveJob::Base | |
| 40 34 | 
             
                @work_proxy.lift_hold
         | 
| 41 35 |  | 
| 42 36 | 
             
                # Check if the parent operation is finished
         | 
| 43 | 
            -
                # and do any cleanup if so
         | 
| 44 | 
            -
                
         | 
| 37 | 
            +
                # and do any cleanup if so    
         | 
| 45 38 | 
             
                if @work_proxy.operation.present? && @work_proxy.operation.respond_to?(:check_if_finished)
         | 
| 46 39 | 
             
                  @work_proxy.operation.check_if_finished 
         | 
| 47 40 | 
             
                end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: bulk_ops
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.11
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ned Henry, UCSC Library Digital Initiatives
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2019-08- | 
| 11 | 
            +
            date: 2019-08-16 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         |