Using GitHub - duffelhq/paginator: Cursor-based pagination for Elixir Ecto
I have a list of Event Entries, with order_by: [desc: entries.ror]
.
The query is:
def list_event_entries(%Event{id: event_id}, %{limit: limit} = page_params) do
from(
entries in Entry,
where: entries.event_id == ^event_id,
order_by: [desc: entries.ror],
preload: [:event, :user]
)
|> Data.Pager.paginate([{:ror, :desc}], limit, page_params)
end
When paging the list (after_cursor
), the second page is skipped because the rate of return
for those entries is 0.0
. When paging back (before_cursor
) the second page is rendered correctly. I have a nearly identical, index component where order_by: [desc: entries.updated_at]
and it works fine.
Page 1:
Click fwd arrow to page 2 but page 3 is rendered:
Click 'back arrow` and Page 2 is returned:
Any ideas what might be happening here that would cause the after_cursor
paged results to not return entries where ror = 0.0
but the before_cursor
does?
- note ignore the
total: 12
, should be 13