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: 5204 - preliminary step for multi-product price addition #5367

Merged
merged 4 commits into from
Jun 14, 2024

Conversation

monsieurtanuki
Copy link
Contributor

What

This is the first step towards multi-product price addition:

  • improved flexibility in the "add price page" as now we can change the product (coming next: adding receipt lines, with their own products and amounts)
  • creation of a "meta" product, in order to treat in a similar way products from "off" and products from "prices"
  • creation of a "product search" page (barcode search), currently with local and server look-ups, with room for many new features

Screenshots

add a price search a product
Screenshot_1718266980 Screenshot_1718266995

Part of

Files

New files:

  • price_amount_model.dart: Model for the price of a single product.
  • price_meta_product.dart: Meta version of a product, coming from OFF or from Prices.
  • price_product_search_page.dart: Product Search Page, for Prices.
  • price_product_list_tile.dart: Displays a meta product with an action button, as a ListTile.

Impacted files:

  • app_en.arb: added 2 labels for the new "price product search" page
  • app_fr.arb: added 2 labels for the new "price product search" page
  • edit_product_page.dart: minor refactoring
  • get_prices_model.dart: minor refactoring
  • price_amount_card.dart: minor refactoring
  • price_amount_field.dart: minor refactoring
  • price_count_widget.dart: minor refactoring
  • price_model.dart: moved product amount code to new class PriceAmountModel
  • price_product_widget.dart: unrelated UI refactoring
  • prices_card.dart: minor refactoring
  • product_price_add_page.dart: minor refactoring

New files:
* `price_amount_model.dart`: Model for the price of a single product.
* `price_meta_product.dart`: Meta version of a product, coming from OFF or from Prices.
* `price_product_search_page.dart`: Product Search Page, for Prices.
* `price_product_list_tile.dart`: Displays a meta product with an action button, as a ListTile.

Impacted files:
* `app_en.arb`: added 2 labels for the new "price product search" page
* `app_fr.arb`: added 2 labels for the new "price product search" page
* `edit_product_page.dart`: minor refactoring
* `get_prices_model.dart`: minor refactoring
* `price_amount_card.dart`: minor refactoring
* `price_amount_field.dart`: minor refactoring
* `price_count_widget.dart`: minor refactoring
* `price_model.dart`: moved product amount code to new class `PriceAmountModel`
* `price_product_widget.dart`: unrelated UI refactoring
* `prices_card.dart`: minor refactoring
* `product_price_add_page.dart`: minor refactoring
@codecov-commenter
Copy link

codecov-commenter commented Jun 13, 2024

Codecov Report

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

Project coverage is 7.42%. Comparing base (4d9c7fc) to head (6bec52a).
Report is 185 commits behind head on develop.

Files Patch % Lines
...oth_app/lib/pages/prices/price_product_widget.dart 0.00% 24 Missing ⚠️
..._app/lib/pages/prices/price_product_list_tile.dart 0.00% 23 Missing ⚠️
...mooth_app/lib/pages/prices/price_amount_model.dart 0.00% 17 Missing ⚠️
...h_app/lib/pages/prices/product_price_add_page.dart 0.00% 12 Missing ⚠️
...smooth_app/lib/pages/prices/price_amount_card.dart 0.00% 9 Missing ⚠️
...mooth_app/lib/pages/prices/price_meta_product.dart 0.00% 9 Missing ⚠️
...kages/smooth_app/lib/pages/prices/price_model.dart 0.00% 7 Missing ⚠️
...mooth_app/lib/pages/prices/price_count_widget.dart 0.00% 4 Missing ⚠️
.../smooth_app/lib/pages/prices/get_prices_model.dart 0.00% 3 Missing ⚠️
...mooth_app/lib/pages/prices/price_amount_field.dart 0.00% 2 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #5367      +/-   ##
==========================================
- Coverage     9.54%   7.42%   -2.13%     
==========================================
  Files          325     383      +58     
  Lines        16411   19482    +3071     
==========================================
- Hits          1567    1447     -120     
- Misses       14844   18035    +3191     

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

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.

What's the point in making the single price also editable? Can't we hide the pencil in those cases ? Making it possible to switch the barcode mid-course seems like a recipe for user mistakes.

@monsieurtanuki
Copy link
Contributor Author

What's the point in making the single price also editable? Can't we hide the pencil in those cases ? Making it possible to switch the barcode mid-course seems like a recipe for user mistakes.

The thing is that PR is a preliminary step: if I remove everything with a strong immediate added-value I can close the PR right away.
The next PR will be about adding/removing receipt lines, where the choice of the product will be relevant, and so would the edit button.
For that I need this PR that provides flexibility between the whole receipt and each individual lines.

I can indeed hide the edit button in this PR. Anyway the UI/UX will evolve.

@monsieurtanuki
Copy link
Contributor Author

@teolemon I've just removed the "edit" button:
Screenshot_1718284539

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.

Thank you @monsieurtanuki 👍

@monsieurtanuki monsieurtanuki merged commit 7bf53e8 into openfoodfacts:develop Jun 14, 2024
6 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @teolemon for your review!

Next step: multi-products! Probably by the end of the week.

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

Successfully merging this pull request may close these issues.

3 participants