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

feat: new field pageCount for searchResult #823

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

monsieurtanuki
Copy link
Contributor

What

  • New field pageCount for SearchResult
  • That will help us solve a minor rare discrepancy between the number of "returned products", the "number of returned products" (pageCount) and the "total number of products" (count).

Impacted files:

  • api_get_user_products_test.dart: now using pageCount instead of count
  • api_search_products_test.dart: skipped a test failing because of the server
  • search_result.dart: added field pageCount
  • search_result.g.dart: generated

Impacted files:
* `api_get_user_products_test.dart`: now using `pageCount` instead of `count`
* `api_search_products_test.dart`: skipped a test failing because of the server
* `search_result.dart`: added field `pageCount`
* `search_result.g.dart`: generated
@codecov-commenter
Copy link

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (415b07d) 76.35% compared to head (1a80bcd) 76.00%.

Files Patch % Lines
lib/src/model/search_result.g.dart 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #823      +/-   ##
==========================================
- Coverage   76.35%   76.00%   -0.36%     
==========================================
  Files         205      205              
  Lines        7537     7539       +2     
==========================================
- Hits         5755     5730      -25     
- Misses       1782     1809      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@g123k g123k left a comment

Choose a reason for hiding this comment

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

LGTM 👍
This may worth a bit of doc to explain the difference between count/pageCount

@@ -15,6 +15,9 @@ class SearchResult extends JsonObject {
@JsonKey(name: 'count', fromJson: JsonObject.parseInt)
final int? count;

Copy link
Member

Choose a reason for hiding this comment

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

// page_count is the number of products requested per page. Please be mindful of server resources, and keep that below 200.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

page_count is the number of products requested per page.

AFAIK it's rather the number of products found within that result page.

@monsieurtanuki monsieurtanuki merged commit 1d88bbf into openfoodfacts:master Nov 15, 2023
5 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @g123k for your review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

4 participants