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: 5594 - multi product scan mode as a dev mode option for price receipt input #6008

Merged
merged 6 commits into from
Dec 20, 2024

Conversation

monsieurtanuki
Copy link
Contributor

What

  • Now there's a new switch in DEV MODE: "multi-products selection for prices"
  • When the switch is true (default is false), when we scan products for prices (e.g. new receipt page) we're able to scan several barcodes in a row, and tap on the floating action button to say "hey, I'm done"

Screenshots

dev mode switch 1 scanned product
Screenshot_20241205_174929 Screenshot_20241205_175303
2 scanned products receipt w/ 2 products
Screenshot_20241205_175437 Screenshot_20241205_175502

Fixes bug(s)

Impacted files

  • price_add_product_card.dart: now calling the scan card with the bool multi product scan mode parameter, and manages a list of scanned barcodes
  • price_scan_page.dart: now manages a multi product scan mode, with floating action button and snackbar
  • user_preferences_dev_mode.dart: new flag for "multi product scan in price receipt"

…eceipt input

Impacted files:
* `price_add_product_card.dart`: now calling the scan card with the bool multi product scan mode parameter, and manages a _list_ of scanned barcodes
* `price_scan_page.dart`: now manages a multi product scan mode, with floating action button and snackbar
* `user_preferences_dev_mode.dart`: new flag for "multi product scan in price receipt"
@codecov-commenter
Copy link

codecov-commenter commented Dec 5, 2024

Codecov Report

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

Project coverage is 6.45%. Comparing base (4d9c7fc) to head (9e5275c).
Report is 571 commits behind head on develop.

Files with missing lines Patch % Lines
...h_app/lib/pages/prices/price_add_product_card.dart 0.00% 35 Missing ⚠️
...s/smooth_app/lib/pages/prices/price_scan_page.dart 0.00% 25 Missing ⚠️
...b/pages/preferences/user_preferences_dev_mode.dart 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #6008      +/-   ##
==========================================
- Coverage     9.54%   6.45%   -3.10%     
==========================================
  Files          325     443     +118     
  Lines        16411   25181    +8770     
==========================================
+ Hits          1567    1625      +58     
- Misses       14844   23556    +8712     

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

@teolemon
Copy link
Member

teolemon commented Dec 6, 2024

@monsieurtanuki @g123k this would be interesting to quickly populate user lists (eg a shopping list).

@monsieurtanuki
Copy link
Contributor Author

@monsieurtanuki @g123k this would be interesting to quickly populate user lists (eg a shopping list).

@teolemon That wouldn't be a problem as we already have the tool for that: a camera+scanner that calls an "I've just found that barcode!" method. In this PR the method populates a list of barcodes, pop'ed only when the user clicks on the FAB.

If you have a new idea for user lists, please create a specific issue.
And don't hesitate to review the current PR ;)

Copy link
Collaborator

@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.

One feedback, but otherwise OK

return false;
}

final List<String> alreadyThere = <String>[];
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can use a Set directly and thus remove barcodeAlreadyThere, by calling only the Set.contain method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you can use a Set directly and thus remove barcodeAlreadyThere, by calling only the Set.contain method.

Indeed, but I assumed the order was important too for the user, and Set is unordered.

@monsieurtanuki monsieurtanuki merged commit fdf1d03 into openfoodfacts:develop Dec 20, 2024
6 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @g123k for your numerous approvals, it's like an early Xmas!

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.

Have an option for continous scanning when entering prices
4 participants