-
-
Notifications
You must be signed in to change notification settings - Fork 14
fix: no questions remaining fixed with pagination #416
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pagination is a bit more complex than. You should handle
- page increment
- page out of range
- reset page when new search values
I think the easiest way is to put all the logic in loadQuestions
method
Notie that you do not always need to incread page
, because if the user answer questions this questions are replaced by new ones in the next API call
src/views/QuestionView.vue
Outdated
if (newBuffer.length == 1) { | ||
this.page += 1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why waiting to reach 1?
Hey @alexfauquette, I am not sure what you meant by this. Could you elaborate on when I should increase the page number? |
@alexfauquette While trying to add the out of range checks, I came across this error and am not able to figure out why it is happening. In the following URL, Could you please help me understand why the questions are not getting displayed in the hunger games website? I am attaching some screenshots for reference |
For the question about "out of range but server send ack questions". I think it is related to the fact non of those questions contains a See #394 (comment) About when to increase the page number: Increasing page numberI assume that as long as Reseting page numberWhen the filter parameters are modified, the page should go back to the beginning Disabling paginationIf the sorting is random, it is not necessary to increase the page No remainingInstead of the following dummy verification I did, we could chack when page is the last one (count/pageSize >= page) after fetching the page, add the |
Hey @alexfauquette
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a quick review. I will have more time to do a better one during the week
} | ||
return; | ||
if (this.remainingQuestionCount / count + 1 < this.page) { | ||
this.page = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are out of range you do not want to set page back to 0, but to add a No_Remaining_Questions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added that condition if somehow the user reaches some page out of range. No remaining questions is added only if the number of total questions remaining becomes less than the page size i.e. 10
What
Closes #394
Screenshot
Currently deployed version:
Link: https://hunger.openfoodfacts.org/questions?country=en%3Aunited-states&type=brand&sorted=true
Screen.Recording.2022-04-06.at.1.28.24.AM.mov
Fix:
Screen.Recording.2022-04-06.at.1.31.08.AM.mov
Fixes bug(s)