cdm_migrator 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 985574c3d7f661fd0f9d1ce9a15e9269fa4c2dafd10d387110695400aff2b762
4
- data.tar.gz: 0c24c2d7beb6f6d9c66a44dd30393c8dae0cb9222c9d6c69186909cdfe074590
3
+ metadata.gz: 52d0b261c3a30d2366fc4ce466c93ba915ad77465fbc5c19b9144ef1c76e30be
4
+ data.tar.gz: 55fae411673e948fdfc7ca0f6f8ddd251cc3821093b0a15aaa03b3059aaad836
5
5
  SHA512:
6
- metadata.gz: 6b06e22ca127a1b5fa304c18edb939c5082cb3251b7c5be202e51f6914e6ab703a3a7c2a3cc992327ae0122eacc52eec5d5ae810e00eb8531b5e49f5a9481a71
7
- data.tar.gz: 2cefe7be69db9247165ec1c03eeadd5bbffbe0b1ed8044f097e6a6070968e77b224706845eb6072d891cdd5718612c93544321b7a2d9a204af8e92ff4cf6388d
6
+ metadata.gz: '09622f0d05d5621802326d634d026deac0e5cf0b8cf61cd46ea2ad502c22c4b7763b318264796d44ae5061895150712b3d254715404033ad905ce81663544304'
7
+ data.tar.gz: e6f9a6398702df628d49faaf5eba31af5b1c8cc604c86c033287fa33879a1fde4dae488491e0530eb6a4bf3b6ab894ef3179eb11a5d984ff548cc8f7762b2f3d
@@ -121,7 +121,7 @@ module CdmMigrator
121
121
  filename = child ? child['pagefile'] : "#{rec.first}.#{rec.last}"
122
122
 
123
123
  if params[:file_system]=='true'
124
- "file://#{file_path(rec.first)}"
124
+ "file://#{file_path(cisoptr)}"
125
125
  elsif @cdm_api == 'server'
126
126
  "#{@cdm_url}:#{@cdm_port}/cgi-bin/showfile.exe?CISOROOT=#{params[:collection]}&CISOPTR=#{cisoptr}"
127
127
  else
@@ -2,7 +2,7 @@ module CdmMigrator
2
2
  class BatchCreateFilesJob < ActiveJob::Base
3
3
  queue_as Hyrax.config.ingest_queue_name
4
4
 
5
- def perform work, ingest_work, user, last_work=false
5
+ def perform work, ingest_work, user
6
6
  ingest_work.files.each do |file|
7
7
  url = file[:url]
8
8
  last_file = ingest_work.files.last==file
@@ -11,10 +11,9 @@ module CdmMigrator
11
11
  actor = Hyrax::Actors::FileSetActor.new(fs, user)
12
12
  actor.create_metadata#(work, visibility: work.visibility)
13
13
  actor.attach_file_to_work(work)
14
- #byebug
15
14
  fs.attributes = file[:metadata]
16
15
  fs.save!
17
- CdmIngestFilesJob.perform_later(fs, url, user, ingest_work, last_file, last_work)
16
+ CdmIngestFilesJob.perform_later(fs, url, user, ingest_work, last_file)
18
17
  end
19
18
  end
20
19
  end
@@ -4,10 +4,9 @@ module CdmMigrator
4
4
 
5
5
  def perform(ingest, user)
6
6
  ingest.data.each do |w|
7
- last_work = ingest.data.last==w
8
7
  ingest_work = IngestWork.new(w, ingest.id)
9
8
  ingest_work.save!
10
- CreateWorkJob.perform_later ingest_work, user, ingest.admin_set_id, ingest.collection_id, last_work
9
+ CreateWorkJob.perform_later ingest_work, user, ingest.admin_set_id, ingest.collection_id
11
10
  end
12
11
 
13
12
  end
@@ -2,7 +2,7 @@ module CdmMigrator
2
2
  class CdmIngestFilesJob < ActiveJob::Base
3
3
  queue_as Hyrax.config.ingest_queue_name
4
4
 
5
- def perform(fs, url, user, ingest_work = nil, last_file = false, last_work = false)
5
+ def perform(fs, url, user, ingest_work = nil, last_file = false)
6
6
  if url.include?("http") && File.extname(url).include?("pdf")
7
7
  download = open(url)
8
8
  dir = Rails.root.join('public', 'uploads', 'csv_pdfs')
@@ -23,7 +23,6 @@ module CdmMigrator
23
23
  ImportUrlJob.perform_now(fs, log(user))
24
24
  end
25
25
  ingest_work.update_attribute('complete', true) if last_file
26
- BatchIngest.find(ingest_work.id).update_attribute('complete', true) if last_work
27
26
  end
28
27
 
29
28
  def log(user)
@@ -2,7 +2,7 @@ module CdmMigrator
2
2
  class CreateWorkJob < ActiveJob::Base
3
3
  queue_as Hyrax.config.ingest_queue_name
4
4
 
5
- def perform(ingest_work, user, admin_set_id, collection_id, last_work=false)
5
+ def perform(ingest_work, user, admin_set_id, collection_id)
6
6
  admin_set = ::AdminSet.find(admin_set_id) rescue nil
7
7
  collection = ::Collection.find(collection_id) rescue nil
8
8
  work = Object.const_get(ingest_work.work_type).new
@@ -13,7 +13,7 @@ module CdmMigrator
13
13
  work.admin_set = admin_set if admin_set
14
14
  work.date_uploaded = DateTime.now
15
15
  work.save
16
- BatchCreateFilesJob.perform_later work, ingest_work, user, last_work
16
+ BatchCreateFilesJob.perform_later work, ingest_work, user
17
17
 
18
18
  end
19
19
  end
@@ -7,11 +7,14 @@ module CdmMigrator
7
7
  end
8
8
 
9
9
  def progress
10
- if complete?
10
+ return "Complete" if complete?
11
+ completed = IngestWork.where(batch_ingest_id: id, complete: true ).length
12
+ if completed==data.length
13
+ complete=true
14
+ save
11
15
  "Complete"
12
16
  else
13
- completed = IngestWork.where(batch_ingest_id: id, complete: true ).length.to_s
14
- "#{completed}/#{size}"
17
+ "#{completed.to_s}/#{size}"
15
18
  end
16
19
  end
17
20
 
@@ -20,7 +23,7 @@ module CdmMigrator
20
23
  end
21
24
 
22
25
  def complete?
23
- self.complete
26
+ complete
24
27
  end
25
28
 
26
29
  def message?
@@ -1,3 +1,3 @@
1
1
  module CdmMigrator
2
- VERSION = '3.0.1'
2
+ VERSION = '3.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cdm_migrator
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sephirothkod
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-20 00:00:00.000000000 Z
11
+ date: 2020-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails