bulkrax 3.0.0 → 3.0.1

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: 3976f63546f72c7a1fcc47ba595aa3e6486f2f6bcf7fb39a65f9cceb61513dc2
4
- data.tar.gz: 267eb1e87602fdc7a510eff6ac61a459c11a1bbc3691b0b07e9aebd9d84de743
3
+ metadata.gz: 7810d87388103e4ff6d160e6acb64a492dcfcf16a23f93ad6848f6cc97f2d9db
4
+ data.tar.gz: 75bee56959564774f20cda642b6c732cd9cb8a4fbd19222222fbac429effc949
5
5
  SHA512:
6
- metadata.gz: 6512d5c1169d1024b9b5e16847772cb8a662b98638127204e198e09463a54bd3c93f36eac12460e20c43156148ff546a85fbea3d01dd9a0a55df179c56fc8b5d
7
- data.tar.gz: f80a6017b2247235a10b7d23fbbd5199464ac018cd7a9d5609ad8a6c97898e7b20b718c8cb2d9821231de9654f68caf6f39359eb82270c4832d15385ad1f7d12
6
+ metadata.gz: 74297cb60a695e46fa97389b6a9a23124c816304d636267e72585a286f370c923aefe0e10727d3a215fc8d7a1eefa579cb84cd3b84b8e8f65a72619c0c10176e
7
+ data.tar.gz: 57e62164db12eb01bbfa200d612ecd0439099e257d760009b289644e93fd043e7edc3f95c08f023fed2746abfc2c57fac996b542abc0cf724794dc78bc422ddc
@@ -82,18 +82,18 @@ module Bulkrax
82
82
  # Work-Collection membership is added to the child as member_of_collection_ids
83
83
  # This is adding the reverse relationship, from the child to the parent
84
84
  def collection_parent_work_child
85
- child_records[:works].each do |child_record|
86
- ::Hyrax::Collections::NestedCollectionPersistenceService.persist_nested_collection_for(parent: parent_record, child: child_record)
87
- # TODO: add counters for :processed_parents and :failed_parents
88
- Bulkrax::ImporterRun.find(importer_run_id).increment!(:processed_relationships) # rubocop:disable Rails/SkipsModelValidations
89
- end
85
+ child_work_ids = child_records[:works].map(&:id)
86
+ parent_record.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX
87
+
88
+ parent_record.add_member_objects(child_work_ids)
89
+ ImporterRun.find(importer_run_id).increment!(:processed_relationships, child_work_ids.count) # rubocop:disable Rails/SkipsModelValidations
90
90
  end
91
91
 
92
92
  # Collection-Collection membership is added to the as member_ids
93
93
  def collection_parent_collection_child
94
94
  child_records[:collections].each do |child_record|
95
95
  ::Hyrax::Collections::NestedCollectionPersistenceService.persist_nested_collection_for(parent: parent_record, child: child_record)
96
- Bulkrax::ImporterRun.find(importer_run_id).increment!(:processed_relationships) # rubocop:disable Rails/SkipsModelValidations
96
+ ImporterRun.find(importer_run_id).increment!(:processed_relationships) # rubocop:disable Rails/SkipsModelValidations
97
97
  end
98
98
  end
99
99
 
@@ -103,14 +103,12 @@ module Bulkrax
103
103
  child_records[:works].each_with_index do |child_record, i|
104
104
  records_hash[i] = { id: child_record.id }
105
105
  end
106
- attrs = {
107
- work_members_attributes: records_hash
108
- }
109
- parent_record.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX if parent_record.respond_to?(:reindex_extent)
106
+ attrs = { work_members_attributes: records_hash }
107
+ parent_record.try(:reindex_extent=, Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX)
110
108
  env = Hyrax::Actors::Environment.new(parent_record, Ability.new(user), attrs)
109
+
111
110
  Hyrax::CurationConcern.actor.update(env)
112
- # TODO: add counters for :processed_parents and :failed_parents
113
- Bulkrax::ImporterRun.find(importer_run_id).increment!(:processed_relationships) # rubocop:disable Rails/SkipsModelValidations
111
+ ImporterRun.find(importer_run_id).increment!(:processed_relationships, child_records[:works].count) # rubocop:disable Rails/SkipsModelValidations
114
112
  end
115
113
 
116
114
  def reschedule(parent_identifier:, importer_run_id:)
@@ -27,6 +27,7 @@ module Bulkrax
27
27
  end
28
28
  exporter_run = ExporterRun.find(args[1])
29
29
  return entry if exporter_run.enqueued_records.positive?
30
+
30
31
  if exporter_run.failed_records.positive?
31
32
  exporter_run.exporter.status_info('Complete (with failures)')
32
33
  else
@@ -96,7 +96,8 @@ module Bulkrax
96
96
  end
97
97
 
98
98
  def current_run
99
- @current_run ||= self.exporter_runs.create!(total_work_entries: self.limit || parser.total)
99
+ total = self.limit || parser.total
100
+ @current_run ||= self.exporter_runs.create!(total_work_entries: total, enqueued_records: total)
100
101
  end
101
102
 
102
103
  def last_run
@@ -142,7 +142,7 @@ module Bulkrax
142
142
 
143
143
  def import_objects(types_array = nil)
144
144
  self.only_updates ||= false
145
- types = types_array || %w[work collection file_set relationship]
145
+ types = types_array || %w[collection work file_set relationship]
146
146
  if parser.class == Bulkrax::CsvParser
147
147
  parser.create_objects(types)
148
148
  else
@@ -21,6 +21,8 @@ module Bulkrax
21
21
  status_info(e)
22
22
  else
23
23
  status_info
24
+ ensure
25
+ self.save!
24
26
  end
25
27
  return @item
26
28
  end
@@ -270,7 +270,7 @@ module Bulkrax
270
270
  # Changed to grep as wc -l counts blank lines, and ignores the final unescaped line (which may or may not contain data)
271
271
  def total
272
272
  @total = importer.parser_fields['total'] || 0 if importer?
273
- @total = importerexporter.entries.count if exporter?
273
+ @total = limit || current_record_ids.count if exporter?
274
274
 
275
275
  return @total || 0
276
276
  rescue StandardError
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bulkrax
4
- VERSION = '3.0.0'
4
+ VERSION = '3.0.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulkrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Kaufman
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-18 00:00:00.000000000 Z
11
+ date: 2022-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -382,7 +382,7 @@ homepage: https://github.com/samvera-labs/bulkrax
382
382
  licenses:
383
383
  - Apache-2.0
384
384
  metadata: {}
385
- post_install_message:
385
+ post_install_message:
386
386
  rdoc_options: []
387
387
  require_paths:
388
388
  - lib
@@ -397,8 +397,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
397
397
  - !ruby/object:Gem::Version
398
398
  version: '0'
399
399
  requirements: []
400
- rubygems_version: 3.1.2
401
- signing_key:
400
+ rubygems_version: 3.1.4
401
+ signing_key:
402
402
  specification_version: 4
403
403
  summary: Import and export tool for Hyrax and Hyku
404
404
  test_files: []