dato 0.6.16 → 0.6.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0313587907c1cc2e822ad7f92aac1284cbfdb9f451758bc3388c9b5a28d6306b'
4
- data.tar.gz: e042db396497a20f4fe597665f8fd839c637b4a615d92b011ac06d33a07b5b94
3
+ metadata.gz: 71d1bdeb92e3e6d4504909f3d0aa3ea63e04a26adf8b1307861049f683957649
4
+ data.tar.gz: 0402e5e79c5b0ac73b4f9156944ccb2f85474dc90b8baec5934937e0a5bdb72e
5
5
  SHA512:
6
- metadata.gz: e59fd529748e518483c0d7769059c1a7ec9df4e2991a9dcfa2d71aeb980340fcc724144106249668e92bfd311e18f16f97f118cc210f701d74a9fb46ed46a44b
7
- data.tar.gz: 8b6c5ed1246ebf78c176dff63d64ca26a3e0d7f004ed73a1e8761beb4c9c503b9a7d6c31064bad3db9ada82e1cb50d206612879e249197c8d25709138fd3a3f3
6
+ metadata.gz: c38908321fb3f30eabf7af679919beea67c7dc9f8167b2f878c29815f28a9d35179bbfb7fbaafdc10820803418cfd9c23db8a3a7262bc48618e3cd24183a0ed7
7
+ data.tar.gz: c1f5a022f86466cf8411cfd9799e1a459ebf4722bc3b95ef8d23c493f3a9c2c11b386fcb4262a27ef1ede53a5329fa2d251730bac6f17c2607444dd980c6f84b
@@ -134,11 +134,16 @@ module Dato
134
134
  item_types.each do |item_type|
135
135
  method = item_type_methods[item_type]
136
136
  if !item_type.singleton && item_type.sortable
137
- @collections_by_type[method].sort_by!(&:position)
137
+ nil_items, valid_items = @collections_by_type[method].partition do |item|
138
+ item.position.nil?
139
+ end
140
+ @collections_by_type[method] = valid_items.sort_by(&:position) + nil_items
138
141
  elsif item_type.ordering_field
139
- @collections_by_type[method].sort_by! do |item|
140
- item[item_type.ordering_field.api_key]
142
+ field = item_type.ordering_field.api_key
143
+ nil_items, valid_items = @collections_by_type[method].partition do |item|
144
+ item[field].nil?
141
145
  end
146
+ @collections_by_type[method] = valid_items.sort_by { |item| item[field] } + nil_items
142
147
  if item_type.ordering_direction == 'desc'
143
148
  @collections_by_type[method].reverse!
144
149
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dato
4
- VERSION = '0.6.16'
4
+ VERSION = '0.6.17'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.16
4
+ version: 0.6.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-04 00:00:00.000000000 Z
11
+ date: 2019-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler