Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDPS-112: Fix pagination page and move to new class #14

Merged
merged 1 commit into from
Jan 31, 2025
Merged

Conversation

danielburnley
Copy link
Contributor

No description provided.

content,
PaginationMetadata(
first = startIndex == 0,
last = (lastIndex + 1) >= collection.size,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondered why the > needed if you've got the coerceAtMost(collection.size - 1) guaranteeing it can't be greater

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't really matter though

pageNumber = page,
size = pageSize,
totalElements = collection.size,
totalPages = Math.ceilDiv(collection.size, pageSize).coerceAtLeast(1),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ceilDiv should in theory give you something at least 1, but no harm enforcing that I guess

Copy link
Contributor

@brightonsbox brightonsbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@brightonsbox brightonsbox merged commit 903a3aa into main Jan 31, 2025
8 checks passed
@brightonsbox brightonsbox deleted the CDPS-1172 branch January 31, 2025 11:00
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.

2 participants