Skip to content

Optimize DREF3 pagination by appeal_code#2739

Open
szabozoltan69 wants to merge 2 commits into
developfrom
feature/dref3-pagination-based-on-appeal-code
Open

Optimize DREF3 pagination by appeal_code#2739
szabozoltan69 wants to merge 2 commits into
developfrom
feature/dref3-pagination-based-on-appeal-code

Conversation

@szabozoltan69
Copy link
Copy Markdown
Contributor

@szabozoltan69 szabozoltan69 commented May 18, 2026

This change shifts DREF3 list pagination to operate on appeal_code values before retrieval, so only the requested page of codes is fetched and serialized.

The new _order_codes() helper defaults to sorting by appeal_code, and supports order_by=created_at or order_by=-created_at based on the first DREF application created_at per code. The _paginate_codes() helper applies offset and limit to that ordered code list rather than to the final row list. As a result, page sizes in rows can vary because one code can expand to multiple stage rows. Stage filtering still happens after retrieval, so it can further reduce the number of rows returned in a page.

The OpenAPI schema for the list endpoint now documents the order_by query parameter and its accepted values.

Overall, the endpoint avoids building the full dataset just to slice it, reducing work and memory for typical paged requests.

@szabozoltan69
Copy link
Copy Markdown
Contributor Author

We switched from sorted(combined) to list(combined) because ordering is now handled later by _order_codes(). That helper applies the default appeal_code sort or the optional order_by=created_at logic, so sorting at the combine step would be redundant and could conflict with order_by.

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.

1 participant