blacklight-spotlight 3.0.2 → 3.0.3

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: 2ef4a4bcb8283379d4091d374feb6d19075868ab8511a6f0727cefea71dda5ab
4
- data.tar.gz: cb49bd3be13930c34cbab5320070659a0301f53936b6e0eaf68b0691d0f74387
3
+ metadata.gz: 931e772ae7165aea85c6664c6c1fcbb615d0397d42d2000b2bc4f7038288ff91
4
+ data.tar.gz: 5eac236663178ff5476f8b58213f8da5757bd7120108b801792247cc194392b4
5
5
  SHA512:
6
- metadata.gz: 0252bbc23f096a58da23ecd47d8b17e1bbfa96dd2ab78e3e677f81d97af948e8ca9665ecd8344ecc18170e13dbd496d2da4d11e928a6f40f6e91e723d711e504
7
- data.tar.gz: 793bbd141a4fe2fb01151b8a3eb0366cf8d32f55bf2dacb8dc011e0a743e0fba7cbc3e63ac9268106ed06b41ba059a25536de62d655c3af6f29c8e87a3655c87
6
+ metadata.gz: 528286f83609189237af8feef3e40048357b37de3770fdf772bc2672c3b0a52230cb1ab9f2ddfb31b59932aba9a0fafdc44ef2d2f79a333db9618ccf34746acf
7
+ data.tar.gz: 16900b7cbc3278b6be875cb0e91441f33860dc13200c36898e36f545d236557eddada90fe99536ed2fecd72538c076f6dd0edadeea9e481b5d7d025b470b93b6
@@ -43,7 +43,7 @@ module Spotlight
43
43
  needs_reindex = false
44
44
 
45
45
  begin
46
- if sidecar.public != to_bool(row[config.csv_visibility])
46
+ if row.headers.include?(config.csv_visibility) && sidecar.public != to_bool(row[config.csv_visibility])
47
47
  sidecar.update(public: to_bool(row[config.csv_visibility]))
48
48
  needs_reindex = true
49
49
  end
@@ -55,7 +55,9 @@ module Spotlight
55
55
  end
56
56
 
57
57
  def count
58
- documents.size
58
+ @count ||= Rails.cache.fetch([exhibit, self, 'count']) do
59
+ documents.size
60
+ end
59
61
  end
60
62
 
61
63
  delegate :blacklight_config, to: :exhibit
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spotlight
4
- VERSION = '3.0.2'
4
+ VERSION = '3.0.3'
5
5
  end
data/spec/examples.txt CHANGED
@@ -650,7 +650,8 @@ example_id
650
650
  ./spec/jobs/spotlight/change_visibility_job_spec.rb[1:1] | passed | 2.86 seconds |
651
651
  ./spec/jobs/spotlight/default_thumbnail_job_spec.rb[1:1] | passed | 0.00146 seconds |
652
652
  ./spec/jobs/spotlight/process_bulk_updates_csv_job_spec.rb[1:1:1] | passed | 0.2189 seconds |
653
- ./spec/jobs/spotlight/process_bulk_updates_csv_job_spec.rb[1:1:2:1] | passed | 0.08658 seconds |
653
+ ./spec/jobs/spotlight/process_bulk_updates_csv_job_spec.rb[1:1:2:1] | failed | 0.62594 seconds |
654
+ ./spec/jobs/spotlight/process_bulk_updates_csv_job_spec.rb[1:1:3:1] | passed | 0.57342 seconds |
654
655
  ./spec/jobs/spotlight/process_bulk_updates_csv_job_spec.rb[1:2:1] | passed | 0.40446 seconds |
655
656
  ./spec/jobs/spotlight/process_bulk_updates_csv_job_spec.rb[1:2:2:1] | passed | 0.49212 seconds |
656
657
  ./spec/jobs/spotlight/reindex_exhibit_job_spec.rb[1:1:1] | passed | 0.05834 seconds |
@@ -7,6 +7,12 @@ FactoryBot.define do
7
7
  exhibit
8
8
  end
9
9
 
10
+ factory :bulk_update_no_cols, class: 'Spotlight::BulkUpdate' do
11
+ file { Rack::Test::UploadedFile.new(File.expand_path(File.join('..', 'fixtures', 'updated-bulk-update-template-no-cols.csv'), __dir__)) }
12
+
13
+ exhibit
14
+ end
15
+
10
16
  factory :tagged_bulk_update, class: 'Spotlight::BulkUpdate' do
11
17
  file { Rack::Test::UploadedFile.new(File.expand_path(File.join('..', 'fixtures', 'updated-bulk-update-template-w-tags.csv'), __dir__)) }
12
18
 
@@ -42,6 +42,6 @@ describe 'Search Result Block', type: :feature, js: true do
42
42
  end
43
43
 
44
44
  # Documents should exist
45
- expect(page).to have_css('.documents .document')
45
+ expect(page).to have_css('.documents-gallery .document')
46
46
  end
47
47
  end
@@ -0,0 +1,4 @@
1
+ Item ID,Item Title
2
+ bm387cy2596,L'AMERIQVE
3
+ cz507zk0531,NEW MEXICO
4
+ dq287tq6352,L'AMERIQUE
@@ -36,6 +36,14 @@ describe Spotlight::ProcessBulkUpdatesCsvJob do
36
36
  expect(SolrDocument.index.connection).not_to have_received(:update)
37
37
  end
38
38
  end
39
+
40
+ context 'without a visibility column' do
41
+ let(:bulk_update) { FactoryBot.create(:bulk_update_no_cols, exhibit: exhibit) }
42
+
43
+ it 'does nothing with the data' do
44
+ expect { subject.perform_now }.not_to(change { exhibit.reload.solr_document_sidecars.where(public: false).count })
45
+ end
46
+ end
39
47
  end
40
48
 
41
49
  describe 'tags' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-spotlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-05-14 00:00:00.000000000 Z
14
+ date: 2021-05-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activejob-status
@@ -1609,6 +1609,7 @@ files:
1609
1609
  - spec/fixtures/iiif_responses.rb
1610
1610
  - spec/fixtures/json-upload-fixture.json
1611
1611
  - spec/fixtures/sample_solr_documents.yml
1612
+ - spec/fixtures/updated-bulk-update-template-no-cols.csv
1612
1613
  - spec/fixtures/updated-bulk-update-template-w-tags.csv
1613
1614
  - spec/fixtures/updated-bulk-update-template.csv
1614
1615
  - spec/helpers/spotlight/application_helper_spec.rb
@@ -1968,6 +1969,7 @@ test_files:
1968
1969
  - spec/fixtures/iiif_responses.rb
1969
1970
  - spec/fixtures/json-upload-fixture.json
1970
1971
  - spec/fixtures/sample_solr_documents.yml
1972
+ - spec/fixtures/updated-bulk-update-template-no-cols.csv
1971
1973
  - spec/fixtures/updated-bulk-update-template-w-tags.csv
1972
1974
  - spec/fixtures/updated-bulk-update-template.csv
1973
1975
  - spec/helpers/spotlight/application_helper_spec.rb