Pagination plugin returns incorect number of pages

Open
#366 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
40/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
ruby, sql
Domain
databases

Research direction

Start by locating the pagination plugin's rel.total calculation and the dataset.unfiltered call, then reproduce the behavior with a filtered relation such as users.active. Done means the total for user.active.pager reflects only active users while unfiltered relations retain their expected totals.

Written by the indexing model from the issue text.

Description

bug

Describe the bug

If you paginate over a filtered relation (say, users.active) then rel.total will return incorrect results since it calls dataset.unfiltered which discard all the filtering.

To Reproduce

user.active.pager.total returns the total number of users

Expected behavior

user.active.pager.total returns the number of active users

Your environment

  • Affects my production application: NO (or maybe? 😅)
Dominant language
Ruby
Stars
220
Forks
97
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rom-rb/rom-sql

All issues in rom-rb/rom-sql

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.