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

Allow page navigation after search #146

Merged
merged 5 commits into from
Sep 19, 2023
Merged

Allow page navigation after search #146

merged 5 commits into from
Sep 19, 2023

Conversation

leefaisonr
Copy link
Contributor

@leefaisonr leefaisonr commented Sep 15, 2023

Ref #22

Co-authored-by: Anna Headley <hackartisan@users.noreply.github.com>
Copy link
Member

@hackartisan hackartisan left a comment

Choose a reason for hiding this comment

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

We should add a test for the search results pagination bug fixed in this PR.

@@ -53,5 +53,9 @@
guide_card19 = GuideCard.create(id: 19)
expect(guide_card19.index_page).to eq 2
end
it 'id 27021 is on page 2702' do
guide_card27021 = GuideCard.create(id: 27021)
expect(guide_card27021.index_page).to eq 2702
Copy link
Member

Choose a reason for hiding this comment

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

2703 seems right. we can update this test or remove it.

leefaisonr and others added 2 commits September 18, 2023 10:50
Note that these cards must be ordered by id, not heading. This is
counterintuitive, because it results in a thing that might not look like
alphabetical order. However, it is the order of the card catalog, which
is wanted by the stakeholder.

Co-authored-by: Bess Sadler <bess@users.noreply.github.com>
@@ -3,12 +3,17 @@
# controller for GuideCards
class GuideCardsController < ApplicationController
def index
@guide_cards = GuideCard.page(params[:page])
@guide_cards = GuideCard.order(:id).page(params[:page])
Copy link
Member

Choose a reason for hiding this comment

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

There's a great commit message about why we're ordering by id. It might be nice to add a similar comment into the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added this logic to our controller as a comment. Thank you!

leefaisonr and others added 2 commits September 19, 2023 11:24
Co-authored-by: Anna Headley <hackartisan@users.noreply.github.com>
Co-authored-by: Bess Sadler <bess@users.noreply.github.com>
@leefaisonr leefaisonr marked this pull request as ready for review September 19, 2023 15:31
@leefaisonr leefaisonr merged commit d838866 into main Sep 19, 2023
@leefaisonr leefaisonr deleted the fix-search branch September 19, 2023 17:55
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