cursor_pager 0.2.2 → 0.2.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: 7c136fc2b06ed62b7e934a79af8b411d72b953e686510920544c04262d76f2e2
4
- data.tar.gz: 443b6ec2ffd61b52e1e4ebc81483a51babe6037c9471eb16d43a0aba44ddebb3
3
+ metadata.gz: 5a61d376be58b8a79f723f16b7a95af05e2204bb3086465518fc0bd33bc118f3
4
+ data.tar.gz: ee0de4fa845db9c541453d6a269c1890f4b1dad8713857015ce5aa75d30b5a15
5
5
  SHA512:
6
- metadata.gz: 435a7a01a58084c5ee22d1f0b669ec7106a8f82666edee8cffe5834adf42c48b453c60453ba5128880cea0d18ecaeb83329521d8ad9230073aa807aab2bbe021
7
- data.tar.gz: 1f5ff16d594ec6dfad4bae98a024f51c4f02cd0e32ac1c7c7f09c1797533280b84a480fc31ec478c9b29b4786364e5bfa5959b00d617e8171bbf178455617cd2
6
+ metadata.gz: 25b37f735e9a74ec8ac7b2ba6bbc25620bf10a35ecfc67bb12df46fca01fc39708dbd6455eccf06de0097b5da981a15f8c26dac7018f4bdd1b7d35e264edd23a
7
+ data.tar.gz: 5bccd36ef0e162445bf633acc7f046ecd423a7e310e02f20362e30d86934054a107506957f4d09d9f07a65e63780ea33fa3a2652879c9cbfbd5acde9fbe14717
@@ -1 +1 @@
1
- 2.7.1
1
+ 2.7.2
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.3] - 2020-11-23
11
+
12
+ ### Fixed
13
+
14
+ * Fix using cursors with preloaded or eager loaded associations #13
15
+
10
16
  ## [0.2.2] - 2020-09-29
11
17
 
12
18
  ### Fixed
@@ -33,7 +39,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
33
39
  * First implementation of cursor-pased pagination #2
34
40
  * Configurable cursor encoder #3
35
41
 
36
- [Unreleased]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.2...HEAD
42
+ [Unreleased]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.3...HEAD
43
+ [0.2.3]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.2...v0.2.3
37
44
  [0.2.2]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.1...v0.2.2
38
45
  [0.2.1]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.0...v0.2.1
39
46
  [0.2.0]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.1.0...v0.2.0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cursor_pager (0.2.2)
4
+ cursor_pager (0.2.3)
5
5
  activerecord (>= 5.2.0)
6
6
 
7
7
  GEM
@@ -1,71 +1,74 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- cursor_pager (0.1.0)
4
+ cursor_pager (0.2.3)
5
5
  activerecord (>= 5.2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (5.2.4.2)
11
- activesupport (= 5.2.4.2)
12
- activerecord (5.2.4.2)
13
- activemodel (= 5.2.4.2)
14
- activesupport (= 5.2.4.2)
10
+ activemodel (5.2.4.4)
11
+ activesupport (= 5.2.4.4)
12
+ activerecord (5.2.4.4)
13
+ activemodel (= 5.2.4.4)
14
+ activesupport (= 5.2.4.4)
15
15
  arel (>= 9.0)
16
- activesupport (5.2.4.2)
16
+ activesupport (5.2.4.4)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 0.7, < 2)
19
19
  minitest (~> 5.1)
20
20
  tzinfo (~> 1.1)
21
- appraisal (2.2.0)
21
+ appraisal (2.3.0)
22
22
  bundler
23
23
  rake
24
24
  thor (>= 0.14.0)
25
25
  arel (9.0.0)
26
- ast (2.4.0)
27
- concurrent-ruby (1.1.6)
28
- database_cleaner (1.8.4)
26
+ ast (2.4.1)
27
+ concurrent-ruby (1.1.7)
28
+ database_cleaner (1.8.5)
29
29
  database_cleaner-active_record (1.8.0)
30
30
  activerecord
31
31
  database_cleaner (~> 1.8.0)
32
- diff-lcs (1.3)
33
- i18n (1.8.2)
32
+ diff-lcs (1.4.4)
33
+ i18n (1.8.5)
34
34
  concurrent-ruby (~> 1.0)
35
- jaro_winkler (1.5.4)
36
- minitest (5.14.0)
37
- parallel (1.19.1)
38
- parser (2.7.1.1)
39
- ast (~> 2.4.0)
35
+ minitest (5.14.2)
36
+ parallel (1.20.1)
37
+ parser (2.7.2.0)
38
+ ast (~> 2.4.1)
40
39
  pg (1.2.3)
41
40
  rainbow (3.0.0)
42
41
  rake (12.3.3)
42
+ regexp_parser (1.8.2)
43
43
  rexml (3.2.4)
44
- rspec (3.9.0)
45
- rspec-core (~> 3.9.0)
46
- rspec-expectations (~> 3.9.0)
47
- rspec-mocks (~> 3.9.0)
48
- rspec-core (3.9.1)
49
- rspec-support (~> 3.9.1)
50
- rspec-expectations (3.9.1)
44
+ rspec (3.10.0)
45
+ rspec-core (~> 3.10.0)
46
+ rspec-expectations (~> 3.10.0)
47
+ rspec-mocks (~> 3.10.0)
48
+ rspec-core (3.10.0)
49
+ rspec-support (~> 3.10.0)
50
+ rspec-expectations (3.10.0)
51
51
  diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.9.0)
53
- rspec-mocks (3.9.1)
52
+ rspec-support (~> 3.10.0)
53
+ rspec-mocks (3.10.0)
54
54
  diff-lcs (>= 1.2.0, < 2.0)
55
- rspec-support (~> 3.9.0)
56
- rspec-support (3.9.2)
57
- rubocop (0.81.0)
58
- jaro_winkler (~> 1.5.1)
55
+ rspec-support (~> 3.10.0)
56
+ rspec-support (3.10.0)
57
+ rubocop (1.4.0)
59
58
  parallel (~> 1.10)
60
- parser (>= 2.7.0.1)
59
+ parser (>= 2.7.1.5)
61
60
  rainbow (>= 2.2.2, < 4.0)
61
+ regexp_parser (>= 1.8)
62
62
  rexml
63
+ rubocop-ast (>= 1.1.1)
63
64
  ruby-progressbar (~> 1.7)
64
65
  unicode-display_width (>= 1.4.0, < 2.0)
66
+ rubocop-ast (1.1.1)
67
+ parser (>= 2.7.1.5)
65
68
  ruby-progressbar (1.10.1)
66
69
  thor (1.0.1)
67
70
  thread_safe (0.3.6)
68
- tzinfo (1.2.7)
71
+ tzinfo (1.2.8)
69
72
  thread_safe (~> 0.1)
70
73
  unicode-display_width (1.7.0)
71
74
 
@@ -1,73 +1,76 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- cursor_pager (0.1.0)
4
+ cursor_pager (0.2.3)
5
5
  activerecord (>= 5.2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (6.0.2.2)
11
- activesupport (= 6.0.2.2)
12
- activerecord (6.0.2.2)
13
- activemodel (= 6.0.2.2)
14
- activesupport (= 6.0.2.2)
15
- activesupport (6.0.2.2)
10
+ activemodel (6.0.3.4)
11
+ activesupport (= 6.0.3.4)
12
+ activerecord (6.0.3.4)
13
+ activemodel (= 6.0.3.4)
14
+ activesupport (= 6.0.3.4)
15
+ activesupport (6.0.3.4)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 0.7, < 2)
18
18
  minitest (~> 5.1)
19
19
  tzinfo (~> 1.1)
20
- zeitwerk (~> 2.2)
21
- appraisal (2.2.0)
20
+ zeitwerk (~> 2.2, >= 2.2.2)
21
+ appraisal (2.3.0)
22
22
  bundler
23
23
  rake
24
24
  thor (>= 0.14.0)
25
- ast (2.4.0)
26
- concurrent-ruby (1.1.6)
27
- database_cleaner (1.8.4)
25
+ ast (2.4.1)
26
+ concurrent-ruby (1.1.7)
27
+ database_cleaner (1.8.5)
28
28
  database_cleaner-active_record (1.8.0)
29
29
  activerecord
30
30
  database_cleaner (~> 1.8.0)
31
- diff-lcs (1.3)
32
- i18n (1.8.2)
31
+ diff-lcs (1.4.4)
32
+ i18n (1.8.5)
33
33
  concurrent-ruby (~> 1.0)
34
- jaro_winkler (1.5.4)
35
- minitest (5.14.0)
36
- parallel (1.19.1)
37
- parser (2.7.1.1)
38
- ast (~> 2.4.0)
34
+ minitest (5.14.2)
35
+ parallel (1.20.1)
36
+ parser (2.7.2.0)
37
+ ast (~> 2.4.1)
39
38
  pg (1.2.3)
40
39
  rainbow (3.0.0)
41
40
  rake (12.3.3)
41
+ regexp_parser (1.8.2)
42
42
  rexml (3.2.4)
43
- rspec (3.9.0)
44
- rspec-core (~> 3.9.0)
45
- rspec-expectations (~> 3.9.0)
46
- rspec-mocks (~> 3.9.0)
47
- rspec-core (3.9.1)
48
- rspec-support (~> 3.9.1)
49
- rspec-expectations (3.9.1)
43
+ rspec (3.10.0)
44
+ rspec-core (~> 3.10.0)
45
+ rspec-expectations (~> 3.10.0)
46
+ rspec-mocks (~> 3.10.0)
47
+ rspec-core (3.10.0)
48
+ rspec-support (~> 3.10.0)
49
+ rspec-expectations (3.10.0)
50
50
  diff-lcs (>= 1.2.0, < 2.0)
51
- rspec-support (~> 3.9.0)
52
- rspec-mocks (3.9.1)
51
+ rspec-support (~> 3.10.0)
52
+ rspec-mocks (3.10.0)
53
53
  diff-lcs (>= 1.2.0, < 2.0)
54
- rspec-support (~> 3.9.0)
55
- rspec-support (3.9.2)
56
- rubocop (0.81.0)
57
- jaro_winkler (~> 1.5.1)
54
+ rspec-support (~> 3.10.0)
55
+ rspec-support (3.10.0)
56
+ rubocop (1.4.0)
58
57
  parallel (~> 1.10)
59
- parser (>= 2.7.0.1)
58
+ parser (>= 2.7.1.5)
60
59
  rainbow (>= 2.2.2, < 4.0)
60
+ regexp_parser (>= 1.8)
61
61
  rexml
62
+ rubocop-ast (>= 1.1.1)
62
63
  ruby-progressbar (~> 1.7)
63
64
  unicode-display_width (>= 1.4.0, < 2.0)
65
+ rubocop-ast (1.1.1)
66
+ parser (>= 2.7.1.5)
64
67
  ruby-progressbar (1.10.1)
65
68
  thor (1.0.1)
66
69
  thread_safe (0.3.6)
67
- tzinfo (1.2.7)
70
+ tzinfo (1.2.8)
68
71
  thread_safe (~> 0.1)
69
72
  unicode-display_width (1.7.0)
70
- zeitwerk (2.3.0)
73
+ zeitwerk (2.4.1)
71
74
 
72
75
  PLATFORMS
73
76
  ruby
@@ -148,14 +148,23 @@ module CursorPager
148
148
  end
149
149
 
150
150
  def limit_value_for(cursor)
151
- id = encoder.decode(cursor)
152
-
153
- selects = order_values.map(&:select_string)
154
- item = ordered_relation.where(id: id).select(selects).first
151
+ item = limit_item_for(cursor)
155
152
 
156
153
  raise CursorNotFoundError, cursor if item.blank?
157
154
 
158
155
  order_values.map { |value| item[value.select_alias] }
159
156
  end
157
+
158
+ def limit_item_for(cursor)
159
+ id = encoder.decode(cursor)
160
+
161
+ selects = order_values.map(&:select_string)
162
+ ordered_relation_copy = ordered_relation.dup
163
+
164
+ ordered_relation_copy.preload_values = []
165
+ ordered_relation_copy.eager_load_values = []
166
+ ordered_relation_copy
167
+ .unscope(:includes).where(id: id).select(selects).first
168
+ end
160
169
  end
161
170
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CursorPager
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cursor_pager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bastian Bartmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-29 00:00:00.000000000 Z
11
+ date: 2020-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
- rubygems_version: 3.1.2
91
+ rubygems_version: 3.1.4
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Cursor-based pagination for ActiveRecord relations.