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: 5326 - add prices to proof from gallery (and thumbnails) #5670

Merged
merged 3 commits into from
Oct 7, 2024

Conversation

monsieurtanuki
Copy link
Contributor

What

  • Now we have faster proof gallery, as we use thumbnails.
  • From the proof page, we have a button to add prices to that proof.
  • Still to be done in order to close the issue: when the user clicks on "select a proof: camera / gallery", add the option "proof gallery".

Screenshots

proof page add price page
Screenshot_1728138605 Screenshot_1728138611

Part of

Files

New files:

  • background_task_add_other_price.dart: Background task about adding prices to an existing proof.
  • background_task_price.dart: Abstract background task about adding prices.

Impacted files:

  • background_task_add_price.dart: refactored using new class BackgroundTaskPrice
  • get_prices_model.dart: new web app root address
  • operation_type.dart: added the new background task
  • osm_location.dart: minor refactoring
  • price_currency_selector.dart: additional case - proof instead of input; refactored using model
  • price_date_card.dart: additional case - proof instead of input
  • price_location_card.dart: additional case - proof instead of input
  • price_model.dart: added specific constructor and background task for the "existing proof" case
  • price_product_widget.dart: minor refactoring
  • price_proof_card.dart: additional case - proof instead of input
  • price_proof_page.dart: added a FAB to add price from an existing proof; now displaying the thumbnail and then the full proof
  • price_user_button.dart: new web app root address
  • prices_proofs_page.dart: proof thumnails; new web app root address
  • prices_users_page.dart: new web app root address
  • product_price_add_page.dart: now accepting a model as parameter, in order to deal with both old proofs and new prices
  • pubspec.lock: wtf
  • pubspec.yaml: upgraded to openfoodfacts 3.16.0, for proof thumbnails
  • user_preferences_account.dart: new web app root address

New files:
* `background_task_add_other_price.dart`: Background task about adding prices to an existing proof.
* `background_task_price.dart`: Abstract background task about adding prices.

Impacted files:
* `background_task_add_price.dart`: refactored using new class `BackgroundTaskPrice`
* `get_prices_model.dart`: new web app root address
* `operation_type.dart`: added the new background task
* `osm_location.dart`: minor refactoring
* `price_currency_selector.dart`: additional case - proof instead of input; refactored using model
* `price_date_card.dart`: additional case - proof instead of input
* `price_location_card.dart`: additional case - proof instead of input
* `price_model.dart`: added specific constructor and background task for the "existing proof" case
* `price_product_widget.dart`: minor refactoring
* `price_proof_card.dart`: additional case - proof instead of input
* `price_proof_page.dart`: added a FAB to add price from an existing proof; now displaying the thumbnail and then the full proof
* `price_user_button.dart`: new web app root address
* `prices_proofs_page.dart`: proof thumnails; new web app root address
* `prices_users_page.dart`: new web app root address
* `product_price_add_page.dart`: now accepting a model as parameter, in order to deal with both old proofs and new prices
* `pubspec.lock`: wtf
* `pubspec.yaml`: upgraded to `openfoodfacts` `3.16.0`, for proof thumbnails
* `user_preferences_account.dart`: new web app root address
@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2024

Codecov Report

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

Project coverage is 6.81%. Comparing base (4d9c7fc) to head (55dabe7).
Report is 348 commits behind head on develop.

Files with missing lines Patch % Lines
...ooth_app/lib/background/background_task_price.dart 0.00% 83 Missing ⚠️
...kages/smooth_app/lib/pages/prices/price_model.dart 0.00% 39 Missing ⚠️
...ib/background/background_task_add_other_price.dart 0.00% 22 Missing ⚠️
.../smooth_app/lib/pages/prices/price_proof_card.dart 0.00% 22 Missing ⚠️
.../smooth_app/lib/pages/prices/price_proof_page.dart 0.00% 22 Missing ⚠️
...ooth_app/lib/pages/prices/price_location_card.dart 0.00% 15 Missing ⚠️
...s/smooth_app/lib/pages/prices/price_date_card.dart 0.00% 13 Missing ⚠️
...s/smooth_app/lib/pages/locations/osm_location.dart 0.00% 12 Missing ⚠️
..._app/lib/pages/prices/price_currency_selector.dart 0.00% 9 Missing ⚠️
..._app/lib/background/background_task_add_price.dart 0.00% 7 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #5670      +/-   ##
==========================================
- Coverage     9.54%   6.81%   -2.74%     
==========================================
  Files          325     404      +79     
  Lines        16411   21506    +5095     
==========================================
- Hits          1567    1466     -101     
- Misses       14844   20040    +5196     

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

@monsieurtanuki monsieurtanuki marked this pull request as draft October 5, 2024 14:43
@monsieurtanuki
Copy link
Contributor Author

Oops, detected a bug, working on it...

Impacted files:
* `osm_location.dart`: more flexibility with potentially null data
* `price_model.dart`: more flexibility with potentially null data; better display of thumbnail image
* `price_proof_page.dart`: more flexibility with potentially null data
@monsieurtanuki monsieurtanuki marked this pull request as ready for review October 7, 2024 07:13
@monsieurtanuki
Copy link
Contributor Author

Oops, detected a bug, working on it...

The bug was about Prices sometimes sending incomplete proof data (e.g. the location field being "unexpectedly" null).
We can deal with it: if the proof data we retrieve from the gallery is not "good enough", we don't show the "add prices to that proof" button.
TBH it only happened once in my tests.
BTW the thumbnail is really cool: when we display the thumbnail while the full image is loading, we hardly notice the difference when the full image replaces the thumbnail. Nice compression!

TL;DR
Ready for review ;)

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.

👍

@monsieurtanuki monsieurtanuki merged commit 19ed4f0 into openfoodfacts:develop Oct 7, 2024
6 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @teolemon for your review!

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