Open sumana2001 opened 2 years ago
Notice that you do not always need to increase
page
, because if the user answers questions these questions are replaced by new ones in the next API call
Hey @alexfauquette, I am not sure what you meant by this. Could you elaborate on when I should increase the page number?
- page out of range
@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, https://hunger.openfoodfacts.org/questions?type=brand&sorted=true it is showing no questions remaining even though there are more than 90000 questions left. But when I did console log in localhost, I found the URL it is sending a request to which is https://robotoff.openfoodfacts.org/api/v1/questions/popular?count=10&lang=en&insight_types=brand When you open the link you can see the questions actually there.
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 source_image_url
field
See https://github.com/openfoodfacts/openfoodfacts-hungergames/issues/394#issuecomment-1060893247
About when to increase the page number:
I assume that as long as robotoff.questions(..., page)
returns question that have never been seen, nor are in the buffer, we can stay on this page. Products are renewed because the user is answering questions, wich decrease the stack
When the filter parameters are modified, the page should go back to the beginning
If the sorting is random, it is not necessary to increase the page
Instead 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 NO_QUESTION_LEFT
to the batch because after this page there is not more questions
Hey @alexfauquette Thank you for dividing the issue into smaller parts and explaining each of them. It really made the entire issue very clear. I tried implementing all the pointers. Please have a look and let me know the changes. Here are the pointers:
What
Closes #394
Screenshot
Currently deployed version: Link: https://hunger.openfoodfacts.org/questions?country=en%3Aunited-states&type=brand&sorted=true
https://user-images.githubusercontent.com/63084088/161840028-c9c68eb7-1f5b-4d6e-8e11-51ddfcda65aa.mov
Fix:
https://user-images.githubusercontent.com/63084088/161840228-187fcac3-8722-4fb5-b0ee-435c5f19c0f2.mov
Fixes bug(s)
394