Skip to content

Commit

Permalink
Only remove SequelPaginator tmp field when present
Browse files Browse the repository at this point in the history
  • Loading branch information
Samze committed Oct 8, 2024
1 parent adfc489 commit 7030e7d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/cloud_controller/paging/sequel_paginator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ def paginate_with_window_function(dataset, per_page, page, table_name)
records = paged_dataset.all

count = records.any? ? records.first[:pagination_total_results] : 0
has_tmp_deferred_id = records.first&.keys&.include?(:tmp_deferred_id)

records.each do |x|
x.values.delete(:pagination_total_results)
x.values.delete(:tmp_deferred_id)
x.values.delete(:tmp_deferred_id) if has_tmp_deferred_id
end
[records, count]
end
Expand All @@ -74,7 +76,7 @@ def paginate_with_extension(dataset, per_page, page, table_name)
end

records = paged_dataset.all
records.each { |x| x.values.delete(:tmp_deferred_id) }
records.each { |x| x.values.delete(:tmp_deferred_id) } if records.first&.keys&.include?(:tmp_deferred_id)

[records, count]
end
Expand Down

0 comments on commit 7030e7d

Please sign in to comment.