-
-
Notifications
You must be signed in to change notification settings - Fork 380
feat: 5553 - add prices for category products #6552
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
Conversation
New files: * `price_category_input_page.dart`: Page that lets the user type in and select a single category for prices. * `price_per_extension.dart`: Extension for PricePer. Impacted files: * `app_en.arb`: added 4 labels related to category and prices * `app_fr.arb`: added 4 labels related to category and prices * `background_task_add_other_price.dart`: added parameters related to category prices * `background_task_add_price.dart`: added parameters related to category prices * `background_task_price.dart`: added parameters related to category prices * `price_add_product_card.dart`: added an "add category product" button * `price_amount_card.dart`: added a DropDownButton for "price per" for category product * `price_amount_model.dart`: taken category prices into consideration * `price_existing_amount_card.dart`: unrelated localization * `price_meta_product.dart`: added a new meta product, related to category * `price_model.dart`: added parameters related to category prices * `smooth_autocomplete_text_field.dart`: added an "onSelected" optional parameter, in order to be able to select immediately a suggestion * `smooth_dropdown.dart`: added an "isExpanded" optional parameter, in order to match the screen width
Impacted files: * `app_en.arb`: additional translations for "price per" * `app_fr.arb`: additional translations for "price per" * `price_existing_amount_field.dart`: localization * `price_meta_product.dart`: minor refactoring * `price_per_extension.dart`: additional translations for "price per"
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6552 +/- ##
==========================================
- Coverage 9.54% 5.69% -3.86%
==========================================
Files 325 512 +187
Lines 16411 30639 +14228
==========================================
+ Hits 1567 1745 +178
- Misses 14844 28894 +14050 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Very cool, some thoughts:
|
Thank you @TTalex for your feedback!
I can do that.
I'm not sure I'm going to do that right now, UX-wise.
I'm sure they sell "home-made muesli" so it wouldn't be a good idea to limit to fruits and vegetables. |
Impacted files: * `app_en.arb`: improved a label and added 3 labels * `app_fr.arb`: improved a label and added 3 labels * `background_task_add_other_price.dart`: now setting origins and labels * `background_task_add_price.dart`: now setting origins and labels * `background_task_price.dart`: now setting origins and labels * `price_add_product_card.dart`: refactored as we now set origins too (in addition to just category) * `price_category_input_page.dart`: refactored as we now set origins too (in addition to just category) * `price_existing_amount_card.dart`: display origins too * `price_meta_product.dart`: now setting and displaying origins too * `price_model.dart`: we now set origins too, and prepared code for labels when ready on the "prices" side * `price_product_list_tile.dart`: now displaying origins too
@TTalex Changed the label into "no barcode" and added origins. @raphael0202 @raphodn @teolemon Something not working with the labels to tags conversion (prefixing with 2-letter iso code), for both "category" and "origins".
|
@teolemon ping |
@g123k @monsieurtanuki ok to merge ? |
Honestly, this is just some spam |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for entering and storing category-based prices alongside barcode-based prices.
- Introduces a new “category input” page and metadata in
PriceMetaProduct
- Extends the pricing model and background tasks to include category tags, origin tags, labels, and price-per units
- Updates multiple UI cards and dropdowns to let users select categories and price-per units
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
smooth_dropdown.dart | Added isExpanded flag to SmoothDropdownButton |
price_product_list_tile.dart | Conditionally show barcode and origin names |
price_per_extension.dart | Added PricePer extension for localized titles |
price_model.dart | Collected category/origin/label/price-per data in tasks |
price_meta_product.dart | New category constructor and related getters |
price_existing_amount_field.dart | Display localized short price-per suffix |
price_existing_amount_card.dart | Show saved category and origin alongside price |
price_category_input_page.dart | New page for entering/selecting a price category |
smooth_autocomplete_text_field.dart | Optional onSelected callback in autocomplete field |
price_amount_model.dart | Validation updated to allow category-only entries |
price_amount_card.dart | Category dropdown for selecting price-per unit |
price_add_product_card.dart | Added button to open category input page |
background_task_price.dart | Serialize/deserialize category/origin/label/price-per |
background_task_add_price.dart | Pass new metadata through to base task |
background_task_add_other_price.dart | Pass new metadata through to base task |
app_fr.arb / app_en.arb | Added localization keys for category and price-per |
Comments suppressed due to low confidence (3)
packages/smooth_app/lib/pages/prices/price_amount_model.dart:63
- [nitpick] The returned error message still says “no product” even when the issue may be a missing category. Consider updating the message to reflect that a category must be provided when no barcode is entered.
if (product.barcode.isEmpty && product.categoryTag.isEmpty) {
packages/smooth_app/lib/pages/prices/price_category_input_page.dart:21
- New UI page
PriceCategoryInputPage
has no accompanying unit or widget tests. Adding tests would help prevent regressions in the category-entry flow.
class PriceCategoryInputPage extends StatefulWidget {
packages/smooth_app/lib/pages/prices/price_existing_amount_card.dart:36
- Property name
originsTags
does not exist onPriceMetaProduct
. The getter is namedoriginTags
, so this should bewidget.price.originTags
.
_originTags = widget.price.originsTags;
They should share the same data, we load it from the server regularly on Robotoff. But there is definitely a bug on openfoodfacts-python, where the matching with |
This allow to solve the issue described here: openfoodfacts/smooth-app#6552 (comment)
Sorry for the late review @monsieurtanuki. ![]() It will have the same look'n'feel as the price addition. |
@g123k Thank your for your comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably indeed survive visually until the next PR if that's the only thing left @monsieurtanuki @g123k
thank you for your patience @monsieurtanuki |
and thanks for this nice addition for Open Prices :-) |
Thank you @teolemon for your review! @g123k Actually I was in the middle of coding your |
I've just created #6645. |
What
Screenshots
Fixes bug(s)
Files
New files:
price_category_input_page.dart
: Page that lets the user type in and select a single category for prices.price_per_extension.dart
: Extension for PricePer.Impacted files:
app_en.arb
: added 4 labels related to category and pricesapp_fr.arb
: added 4 labels related to category and pricesbackground_task_add_other_price.dart
: added parameters related to category pricesbackground_task_add_price.dart
: added parameters related to category pricesbackground_task_price.dart
: added parameters related to category pricesprice_add_product_card.dart
: added an "add category product" buttonprice_amount_card.dart
: added a DropDownButton for "price per" for category productprice_amount_model.dart
: taken category prices into considerationprice_existing_amount_card.dart
: unrelated localizationprice_meta_product.dart
: added a new meta product, related to categoryprice_model.dart
: added parameters related to category pricessmooth_autocomplete_text_field.dart
: added an "onSelected" optional parameter, in order to be able to select immediately a suggestionsmooth_dropdown.dart
: added an "isExpanded" optional parameter, in order to match the screen width