Skip to content

fix: paginate get_favorites_ids by 50 favorites per page - #51

Closed
wzd8888 wants to merge 1 commit into
b3yc0d3:masterfrom
wzd8888:fix/favorites-pagination
Closed

wzd8888 wants to merge 1 commit into
b3yc0d3:masterfrom
wzd8888:fix/favorites-pagination

Conversation

@wzd8888

@wzd8888 wzd8888 commented Oct 13, 2026

Copy link
Copy Markdown

Problem

get_favorites_ids computed the favorites page offset as:

page_id = (50 * page_id) + 50 if page_id >= 1 else 0

so the second page (page_id=1) was requested with pid=100 instead of pid=50.
rule34.xxx shows 50 favorites per page and links its next page as pid=50 (see the
paginator link on the favorites view). Iterating over a user's favorites one page at a
time therefore skipped a page from page 1 onward, because pid=100 is the third page,
not the second.

Fix

The offset is simply:

page_id = 50 * page_id

Tests

Adds test_rule34Py_get_favorites_ids_pagination, which asserts that page_id=1
requests pid=50 (and not pid=100). The existing page_id=0 behavior is unchanged
(pid=0). Full suite: 36 passed.

Fixes #50

Note: this change was prepared by an AI agent under human direction and review.

get_favorites_ids computed the favorites page offset as
`(50 * page_id) + 50` for `page_id >= 1`, so the second page
(`page_id=1`) was requested with `pid=100` instead of `pid=50`.

rule34.xxx shows 50 favorites per page, and the favorites page links
its next page as `pid=50`. As a result, iterating over favorites one
page at a time skipped a page from page 1 onward, since `pid=100` is
the third page, not the second.

The offset is simply `50 * page_id`. Add a regression test asserting
that `page_id=1` requests `pid=50` (and not `pid=100`).

Signed-off-by: wzd8888 <wzd8888@users.noreply.github.com>
@wzd8888 wzd8888 closed this Oct 13, 2026
@wzd8888

wzd8888 commented Oct 13, 2026

Copy link
Copy Markdown
Author

Closing this one — focusing contributions elsewhere. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get_favorites_ids pid Calculation Bug

1 participant