blacklight_range_limit 8.2.1 → 8.2.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: 05ea7ff70dd0f999147d9990af32784b0df857878223bab69db8017b48306e28
4
- data.tar.gz: 44ce74fe4ec5d225e6da988e20b26710495e468e553e780e4e1e83d318dbf8bd
3
+ metadata.gz: 96efdd2c39ae998b673a2fb74ffbccad22029baf46d3e712550c84c726b93d82
4
+ data.tar.gz: a27043d01e1b52f8d7a9a648e14aed7c71c6f42c0b94f7329f77a128d8867659
5
5
  SHA512:
6
- metadata.gz: b1b66e4213828f0d2e86625e749a4d406217afb46000e3d8b294d0f3921b5451fa8a5647a9c480ad430b76e38aed2e29db0cd1ab550973b0861e24871c16666c
7
- data.tar.gz: 729b9a29d7038dab2aa092939dfe83b8503edc1641812ff0f7b692de4fedda649f7d1f18b5395ccc61591f83956a0a87fe3dfd0159f717bac947bb2ae86e5f58
6
+ metadata.gz: e933468fe64cbabfdc2a0d7e9dbdd9ff1980e8c7537538ae275b5f49b95759bab53f08980f4d6438aa9dfb667ed7ae119d748e1e57b6cd9b6b36029991f0e5e8
7
+ data.tar.gz: adfc06b26edefc9f9389c4c111830905af993256877fbc58acd91784fcd09cecf815360172e30b71a8242ccf5a398fe86ced25c5ec05523acf9931437d80fd27
data/VERSION CHANGED
@@ -1 +1 @@
1
- 8.2.1
1
+ 8.2.2
@@ -50,17 +50,16 @@ module BlacklightRangeLimit
50
50
  def values(except: [])
51
51
  params = search_state.params
52
52
  param_key = filters_key
53
- return [] unless params.dig(param_key, config.key)
54
-
55
53
  range = if params.dig(param_key, config.key).is_a? Range
56
54
  params.dig(param_key, config.key)
57
- else
55
+ elsif params.dig(param_key, config.key).is_a? Hash
58
56
  begins = Array(params.dig(param_key, config.key, :begin)).map(&:presence)
59
57
  ends = Array(params.dig(param_key, config.key, :end)).map(&:presence)
60
58
  begins.zip(ends).map { |b_bound, e_bound| Range.new(b_bound&.to_i, e_bound&.to_i) if b_bound && e_bound }.compact
61
59
  end
62
60
 
63
61
  f = except.include?(:filters) ? [] : Array(range)
62
+
64
63
  f_missing = [] if except.include?(:missing)
65
64
  f_missing ||= [Blacklight::SearchState::FilterField::MISSING] if params.dig(filters_key, "-#{key}")&.any? { |v| v == Blacklight::Engine.config.blacklight.facet_missing_param }
66
65
 
@@ -57,7 +57,7 @@ RSpec.describe BlacklightRangeLimit::FilterField do
57
57
  end
58
58
  end
59
59
 
60
- context 'with missing data' do
60
+ context 'with empty data' do
61
61
  let(:param_values) { { range: { some_field: { begin: '', end: '' } } } }
62
62
 
63
63
  describe '#values' do
@@ -67,6 +67,17 @@ RSpec.describe BlacklightRangeLimit::FilterField do
67
67
  end
68
68
  end
69
69
 
70
+ context 'with missing data' do
71
+ let(:param_values) { { range: { '-some_field': ['[* TO *]']} } }
72
+
73
+ describe '#values' do
74
+ it 'uses the missing special value' do
75
+ expect(filter.values).to eq [Blacklight::SearchState::FilterField::MISSING]
76
+ end
77
+ end
78
+ end
79
+
80
+
70
81
  context 'with array-mangled data' do
71
82
  let(:param_values) { { range: { some_field: { begin: { '0' => '2013' }, end: { '0' => '2022' } } } } }
72
83
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_range_limit
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.2.1
4
+ version: 8.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-06-21 00:00:00.000000000 Z
12
+ date: 2022-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight