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

Add pagination info to Vets::Collection #20095

Merged
merged 9 commits into from
Jan 8, 2025

Conversation

stevenjcumming
Copy link
Contributor

@stevenjcumming stevenjcumming commented Jan 3, 2025

Mergers to a feature branch

Summary

  • Add new paginate method to collection clas
  • Create a new class Pagination to handle pagination details and record shifting

Related issue(s)

Testing done

  • Manual testing
  • New spec for module

Acceptance criteria

  • Collections of Vets::Models can paginate
  • WillPagination::Collection can paginate
  • Pagination functionality has the same default as Common::Collection

Copy link

github-actions bot commented Jan 3, 2025

1 Warning
⚠️ This PR changes 270 LoC (not counting whitespace/newlines).

In order to ensure each PR receives the proper attention it deserves, we recommend not exceeding
200. Expect some delays getting reviews.

File Summary

Files

  • lib/vets/collection.rb (+32/-1)

  • lib/vets/collections/pagination.rb (+41/-0)

  • spec/lib/vets/collection_spec.rb (+134/-15)

  • spec/lib/vets/collections/pagination_spec.rb (+47/-0)

    Note: We exclude files matching the following when considering PR size:

    *.csv, *.json, *.tsv, *.txt, *.md, Gemfile.lock, app/swagger, modules/mobile/docs, spec/fixtures/, spec/support/vcr_cassettes/, modules/mobile/spec/support/vcr_cassettes/, db/seeds, modules/vaos/app/docs, modules/meb_api/app/docs, modules/appeals_api/app/swagger/, *.bru, *.pdf
    

Big PRs are difficult to review, often become stale, and cause delays.

Generated by 🚫 Danger

Copy link

github-actions bot commented Jan 3, 2025

Error: A file (or its parent directories) was deleted but its reference still exists in CODEOWNERS. Please update the .github/CODEOWNERS file and delete the entry for the Offending file:

Copy link

github-actions bot commented Jan 3, 2025

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file:

@va-vfs-bot va-vfs-bot temporarily deployed to sjc-vets-collection-pagination/main/main January 3, 2025 18:42 Inactive
Copy link

github-actions bot commented Jan 3, 2025

Error: A file (or its parent directories) was deleted but its reference still exists in CODEOWNERS. Please update the .github/CODEOWNERS file and delete the entry for the Offending file:

Copy link

github-actions bot commented Jan 3, 2025

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file:

@va-vfs-bot va-vfs-bot temporarily deployed to sjc-vets-collection-pagination/main/main January 3, 2025 19:00 Inactive
Copy link

github-actions bot commented Jan 3, 2025

Error: A file (or its parent directories) was deleted but its reference still exists in CODEOWNERS. Please update the .github/CODEOWNERS file and delete the entry for the Offending file:

Copy link

github-actions bot commented Jan 3, 2025

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file:

@stevenjcumming stevenjcumming changed the title Sjc vets collection pagination Add pagination info to Vets::Collection Jan 3, 2025
@va-vfs-bot va-vfs-bot temporarily deployed to sjc-vets-collection-pagination/main/main January 3, 2025 19:28 Inactive
Copy link

github-actions bot commented Jan 3, 2025

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file:

Copy link

github-actions bot commented Jan 3, 2025

Error: A file (or its parent directories) was deleted but its reference still exists in CODEOWNERS. Please update the .github/CODEOWNERS file and delete the entry for the Offending file:

Copy link

github-actions bot commented Jan 7, 2025

Error: A file (or its parent directories) was deleted but its reference still exists in CODEOWNERS. Please update the .github/CODEOWNERS file and delete the entry for the Offending file:

Copy link

github-actions bot commented Jan 7, 2025

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file:

if defined?(::WillPaginate::Collection)
records_will_paginate_collection = records.is_a?(WillPaginate::Collection)
error_message = 'Expected records to be instance of WillPaginate'
raise ArgumentError, error_message if records_will_paginate_collection
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the raise ArgumentError logic here be the inverse?

unless records_will_paginate_collection

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thank you!

@LindseySaari LindseySaari requested review from LindseySaari and a team January 7, 2025 13:49
@stevenjcumming
Copy link
Contributor Author

@LindseySaari I fixed the error you found and I also added a test

Copy link

github-actions bot commented Jan 7, 2025

Error: A file (or its parent directories) was deleted but its reference still exists in CODEOWNERS. Please update the .github/CODEOWNERS file and delete the entry for the Offending file:

Copy link

github-actions bot commented Jan 7, 2025

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file:

@LindseySaari
Copy link
Contributor

@stevenjcumming Do you plan to merge this into master or your other base branch? I see CODEOWNERS is failing but I think that's ok if you're not merging into master. It seems it's having issue with comparing to a feature branch

@stevenjcumming
Copy link
Contributor Author

@stevenjcumming Do you plan to merge this into master or your other base branch? I see CODEOWNERS is failing but I think that's ok if you're not merging into master. It seems it's having issue with comparing to a feature branch

I'm just merging it into the collection feature branch. I thought it would be easier to separate the PRs like this before merging them into master.

@stevenjcumming stevenjcumming merged commit 0fa3084 into sjc-vets-collection Jan 8, 2025
18 of 20 checks passed
@stevenjcumming stevenjcumming deleted the sjc-vets-collection-pagination branch January 8, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants