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: 5203 - "add receipt" and "add price tags", even offline or not found #5392

Merged
merged 4 commits into from
Jun 18, 2024

Conversation

monsieurtanuki
Copy link
Contributor

What

  • This PR introduces the notions of "no product yet" and "product not found" meta-products
  • Thanks to "no product yet", we added the "add receipt" and "add price tags" buttons, as we can now start from an empty product list = a list of a single "no product yet" meta-product.
  • Thanks to "product not found", we make the server lookup optional.
  • As an interesting side-effect, it means that adding prices can now be performed 100% offline. I did try, and it did work!

Screenshots

Additional "add prices" buttons "no product yet"
Screenshot_1718555942 Screenshot_1718555950
cannot find product product not found
Screenshot_1718556007 Screenshot_1718555976

Et voilà:
Capture d’écran 2024-06-16 à 18 20 25

Fixes bug(s)

Part of

Impacted files

  • app_en.arb: added 2 "add" and 4 "price product" labels
  • app_fr.arb: added 2 "add" and 4 "price product" labels
  • edit_product_page.dart: minor refactoring
  • get_prices_model.dart: minor refactoring
  • price_amount_card.dart: added the case of "no product yet"
  • price_amount_model.dart: added "no product yet" check
  • price_meta_product.dart: 2 more cases - "no product yet" and "not found product"
  • price_product_list_tile.dart: minor refactoring
  • price_product_search_page.dart: now we accept "not found" products and we don't force the server lookup
  • prices_card.dart: minor refactoring
  • product_price_add_page.dart: minor refactoring
  • user_preferences_account.dart: added "Add receipt" and "Add price tags"

…found

Impacted files:
* `app_en.arb`: added 2 "add" and 4 "price product" labels
* `app_fr.arb`: added 2 "add" and 4 "price product" labels
* `edit_product_page.dart`: minor refactoring
* `get_prices_model.dart`: minor refactoring
* `price_amount_card.dart`: added the case of "no product yet"
* `price_amount_model.dart`: added "no product yet" check
* `price_meta_product.dart`: 2 more cases - "no product yet" and "not found product"
* `price_product_list_tile.dart`: minor refactoring
* `price_product_search_page.dart`: now we accept "not found" products and we don't force the server lookup
* `prices_card.dart`: minor refactoring
* `product_price_add_page.dart`: minor refactoring
* `user_preferences_account.dart`: added "Add receipt" and "Add price tags"
@codecov-commenter
Copy link

codecov-commenter commented Jun 16, 2024

Codecov Report

Attention: Patch coverage is 0% with 72 lines in your changes missing coverage. Please review.

Project coverage is 7.25%. Comparing base (4d9c7fc) to head (8e45972).
Report is 200 commits behind head on develop.

Files Patch % Lines
...mooth_app/lib/pages/prices/price_meta_product.dart 0.00% 29 Missing ⚠️
...pp/lib/pages/prices/price_product_search_page.dart 0.00% 16 Missing ⚠️
...smooth_app/lib/pages/prices/price_amount_card.dart 0.00% 12 Missing ⚠️
...ib/pages/preferences/user_preferences_account.dart 0.00% 10 Missing ⚠️
...mooth_app/lib/pages/prices/price_amount_model.dart 0.00% 4 Missing ⚠️
..._app/lib/pages/prices/price_product_list_tile.dart 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #5392      +/-   ##
==========================================
- Coverage     9.54%   7.25%   -2.30%     
==========================================
  Files          325     391      +66     
  Lines        16411   20078    +3667     
==========================================
- Hits          1567    1456     -111     
- Misses       14844   18622    +3778     

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

@teolemon
Copy link
Member

@monsieurtanuki @g123k I would like take the occasion to solve the horrendous low connectivity/ airplane mode experience``, not just for prices, but for products.

We could have a "Add unselected images" only experience, but we could also try to be useful for regular users.

I believe if we want to solve it, we have to write ourselves a script to slice down the daily data exports by country and propose it to the server.

That way, we'll know whether the product actually exists (modulo 2000 products added everyday, plus products that are not tagged as sold in your country, plus other edges cases).
We need to see if we can at least cram the product name, and possibly more (score letters).

What do you think?

@teolemon
Copy link
Member

#18

Currently, the solution we have in dev mode would bring the server down

@monsieurtanuki
Copy link
Contributor Author

@teolemon I would focus on this PR first, as it is remotely related to offline product scan.

Continued conversation in #18 (comment)

@teolemon teolemon requested a review from g123k June 16, 2024 19:25
Copy link
Member

@teolemon teolemon left a comment

Choose a reason for hiding this comment

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

Thanks @monsieurtanuki 👍

@teolemon teolemon merged commit b9f83c4 into openfoodfacts:develop Jun 18, 2024
6 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @teolemon for your review!

Working on some improvements - and I've found at least one bug (typically when you remove a product).
cf. #5403

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

Successfully merging this pull request may close these issues.

Replicate the 'Add Multiple products' view from the Open Prices web app
3 participants