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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Temporarily fixes double pagination on /questions/tag/ #8479

Closed
wants to merge 1 commit into from

Conversation

tyler-wel
Copy link
Contributor

@tyler-wel tyler-wel commented Oct 8, 2020

Fixes #7530

Checks

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • PR is descriptively titled 馃搼 and links the original issue above 馃敆
  • tests pass -- look for a green checkbox 鉁旓笍 a few minutes after opening your PR -- or run tests locally with rake test
  • code is in uniquely-named feature branch and has no merge conflicts 馃搧
  • screenshots/GIFs are attached 馃搸 in case of UI updation
  • ask @publiclab/reviewers for help, in a comment below

Description

Changes the _answered html fragment to check the existence of @answered_questions before rendering the pagy pagination.

Note, that this was not actually tested with answered questions because it seems that the Asked/Answered tabs are broken under the questions/tag screen. Clicking either tab does not change anything. @jywarren

Before

image

After

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software

Thanks!

@gitpod-io
Copy link

gitpod-io bot commented Oct 8, 2020

@codecov
Copy link

codecov bot commented Oct 8, 2020

Codecov Report

Merging #8479 into main will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8479   +/-   ##
=======================================
  Coverage   82.01%   82.01%           
=======================================
  Files         101      101           
  Lines        5899     5894    -5     
=======================================
- Hits         4838     4834    -4     
+ Misses       1061     1060    -1     
Impacted Files Coverage 螖
app/models/node.rb 91.45% <酶> (-0.07%) 猬囷笍
app/controllers/comment_controller.rb 86.95% <100.00%> (酶)
app/controllers/map_controller.rb 50.00% <100.00%> (酶)
app/controllers/questions_controller.rb 90.78% <100.00%> (酶)
app/controllers/search_controller.rb 97.67% <100.00%> (酶)
app/controllers/users_controller.rb 81.04% <100.00%> (-0.08%) 猬囷笍
app/models/spamaway.rb 97.43% <0.00%> (+2.56%) 猬嗭笍

@jywarren
Copy link
Member

jywarren commented Oct 9, 2020

Hi, this is looking good so far... did you need any help with it? Thanks!

@tyler-wel
Copy link
Contributor Author

@jywarren There were some comments I made in the issue, and I realized the suggested fix doesn't 100% fix it... 馃様

It's mainly because _questions and _tag => _answered are both rendering their @pagy blocks at the same time, and both controllers are using the @questions variable. The whole page it self doesn't seem to be working quite right, because when clicking on the asked and answered tabs at the top of the page doesn't change anything.

@jywarren
Copy link
Member

jywarren commented Nov 5, 2020

@jywarren There were some comments I made in the issue, and I realized the suggested fix doesn't 100% fix it... 馃様

It's mainly because _questions and _tag => _answered are both rendering their @pagy blocks at the same time, and both controllers are using the @questions variable. The whole page it self doesn't seem to be working quite right, because when clicking on the asked and answered tabs at the top of the page doesn't change anything.

Hi @tyler-wel - i'm so sorry it took me a while to circle back to this. Let me look at your code and maybe call in some help... i really appreciate your work here! Noting that this is still an issue at https://publiclab.org/questions/tag/water-quality and even the latest code at https://stable.publiclab.org/questions/tag/water-quality so this will be great to figure out. 馃帀

<%== pagy_bootstrap_nav @pagy %>
<% else %>
<%= will_paginate @questions, :renderer => WillPaginate::ActionView::BootstrapLinkRenderer unless @unpaginated || @questions.empty? %>
<% if @answered_questions.present? %>
Copy link
Member

Choose a reason for hiding this comment

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

So, is the issue here that one of the pagination elements is for answered questions and the other is for unanswered? Looking at the two includes at

<div class="tab-content">
<div class="tab-pane active" id="asked-tab">
<%= render partial: "questions/new_question" %>
</div>
<div class="tab-pane" id="answered-tab">
<% if @answered_questions %>
<%= render partial: "users/answered" %>
<% end %>
</div>

To test this theory, we could try commenting out one and seeing if the double pagination helper disappears.

Just to note, I believe we are OK eliminating the distinction between answered and unanswered in this display. Pinging @ebarry to confirm though.

Copy link
Member

Choose a reason for hiding this comment

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

yes it does sound ok to eliminate the "answered | unanswered" toggle and the associated pagination.

One idea towards helping people choose which question card to potentially click on is to pull out the # of comments that is contained in the ... on each question card, and perhaps show these #s directly on the card to give people a sense of where there's a lot of dialogue/engagement.

Copy link
Member

Choose a reason for hiding this comment

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

OK, great, so confirmed we can just remove the toggle, and hopefully that resolves the double pagination too!

I'm breaking out the design discussion portion into its own issue at: #8731

Copy link
Member

Choose a reason for hiding this comment

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

Also we will move over to #8689 -- 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.

page number buttons are displayed twice
3 participants