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: 802 - new "get product" method specific to OBF OPF OPFF #806

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

monsieurtanuki
Copy link
Contributor

What

  • OBF OPF OPFF do no support API V3.
  • As we switched for OFF to full API V3, we needed to reintroduce a support of API V<3.
  • This is done with getOldProduct, that work with OBF OPF OPFF (and also OFF).
  • Perhaps another solution would be to ignore the "get unique product(barcode)" method and consider it just a special case of "get all products(barcodes)".
  • Anyway, from now on we can retrieve OBF OPF OPFF products from a single barcode with getOldProduct.

Fixes bug(s)

Files

New files:

  • api_not_food_get_product_test.dart: tests around OBF OPF OPFF and getOldProduct
  • old_product_result.dart: Product Result (old style).
  • old_product_result.g.dart: generated

Impacted files:

  • open_food_api_client.dart: new getOldProduct method, dedicated to OBF OPF OPFF, and supposed to disappear when they support API V3.
  • openfoodfacts.dart: exported new class.

New files:
* `api_not_food_get_product_test.dart`: tests around OBF OPF OPFF and `getOldProduct`
* `old_product_result.dart`: Product Result (old style).
* `old_product_result.g.dart`: generated

Impacted files:
* `open_food_api_client.dart`: new `getOldProduct` method, dedicated to OBF OPF OPFF, and supposed to disappear when they support API V3.
* `openfoodfacts.dart`: exported new class.
@codecov-commenter
Copy link

Codecov Report

Merging #806 (24f57bb) into master (7753cb0) will increase coverage by 0.04%.
The diff coverage is 85.24%.

@@            Coverage Diff             @@
##           master     #806      +/-   ##
==========================================
+ Coverage   74.80%   74.84%   +0.04%     
==========================================
  Files         201      204       +3     
  Lines        7314     7375      +61     
==========================================
+ Hits         5471     5520      +49     
- Misses       1843     1855      +12     
Files Changed Coverage Δ
lib/src/model/old_product_result.g.dart 53.84% <53.84%> (ø)
lib/src/model/old_product_result.dart 60.00% <60.00%> (ø)
lib/src/open_food_api_client.dart 58.00% <88.88%> (+1.02%) ⬆️
test/api_not_food_get_product_test.dart 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@M123-dev M123-dev left a comment

Choose a reason for hiding this comment

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

👍🏼

@monsieurtanuki
Copy link
Contributor Author

Thank you @M123-dev for your review!

@monsieurtanuki monsieurtanuki merged commit e824de2 into openfoodfacts:master Sep 20, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

OBF OPF OPFF currently incompatible with api v3
3 participants