Skip to content

Commit 47a118c

Browse files
committed
Fix sort in receiving
1 parent f4506e4 commit 47a118c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/table_sync/receiving/handler.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def call
2323

2424
validate_data(data, target_keys: target_keys)
2525

26-
data.sort_by! { |row| row.values_at(*target_keys).to_s }
26+
data.sort_by! { |row| row.values_at(*target_keys).map { |value| sort_key(value) } }
2727

2828
params = { data: data, target_keys: target_keys, version_key: version_key }
2929

@@ -149,4 +149,8 @@ def perform(config, params)
149149
end
150150
end
151151
end
152+
153+
def sort_key(value)
154+
value.is_a?(Comparable) ? value : value.to_s
155+
end
152156
end

0 commit comments

Comments
 (0)