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

fix: 3249 - refresh of product after each Robotoff answer #3336

Merged
merged 1 commit into from
Nov 22, 2022

Conversation

monsieurtanuki
Copy link
Contributor

Impacted files:

  • abstract_background_task.dart: now uses a new ProductRefresher method for query execution
  • barcode_product_query.dart: now uses a new ProductRefresher method for query execution
  • onboarding_data_product.dart: now uses a new ProductRefresher method for query configuration
  • product_refresher.dart: created methods for standard query configuration and execution
  • question_card.dart: added a fallback product; now uses a new ProductRefresher method for query execution
  • question_page.dart: added a fallback product to the QuestionCard; now refreshes the product locally after each answer
  • summary_card.dart: removed an unnecessary product refresh with loading dialog

What

  • Now we refresh the product after each Robotoff answer.
  • That's invisible for the user (no additional dialog) as it's part of the "saving your answer" dialog/query.
  • The Robotoff page is now displayed immediately. There used to be a visible product refresh before. Now the refresh is invisible, and we display the input (out of date?) product as a fallback during the refresh.
  • All those fixes and optimizations only make sense on a "product robotoff session". For Hunger Games (where we don't know the product beforehand) no big change.
  • That was an opportunity for refactoring: now the calls to off-dart getProduct methods are mainly performed by ProductRefresher, for consistency.
  • This PR goes with 2 new TODOs:
    • what should we do in Robotoff page if we cannot download a product and have no fallback - for the moment (it was the case before) we have a sort of forever loop (cf. QuestionCard)
    • we refresh the product after an answer and before a new question - there's room for optimization there, we could avoid one call (cf. QuestionPage)
  • This PR goes with different UI/UX suggestions:
    • especially in Hunger Games, we could have "instant answers" - a bit like what we do for background tasks, we could not await saving the results (we still would have to download the next product)
    • in Robotoff questions there is one (or many) pictures, and if you click on it you go to the picture list page, and then you have to click on "your" picture to go to an "edit picture" page. It should be faster (directly to the single picture page) and with no edit feature. cf. Simplify adding photos by removing 2 of the 4 steps #3332
    • Generally speaking, the Robotoff UI could be improved, for instance by improving the initial CircularProgressIndicator (with a "Next question is being loaded..." dialog for instance?)

Fixes bug(s)

Impacted files:
* `abstract_background_task.dart`: now uses a new `ProductRefresher` method for query execution
* `barcode_product_query.dart`: now uses a new `ProductRefresher` method for query execution
* `onboarding_data_product.dart`: now uses a new `ProductRefresher` method for query configuration
* `product_refresher.dart`: created methods for standard query configuration and execution
* `question_card.dart`: added a fallback product; now uses a new `ProductRefresher` method for query execution
* `question_page.dart: added a fallback product to the `QuestionCard`; now refreshes the product locally after each answer
* `summary_card.dart`: removed an unnecessary product refresh with loading dialog
@codecov-commenter
Copy link

Codecov Report

Merging #3336 (497996a) into develop (a141bdf) will increase coverage by 0.01%.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##           develop    #3336      +/-   ##
===========================================
+ Coverage    10.49%   10.50%   +0.01%     
===========================================
  Files          253      253              
  Lines        12313    12297      -16     
===========================================
  Hits          1292     1292              
+ Misses       11021    11005      -16     
Impacted Files Coverage Δ
...h_app/lib/background/abstract_background_task.dart 0.00% <0.00%> (ø)
...h_app/lib/data_models/onboarding_data_product.dart 0.00% <0.00%> (ø)
...ooth_app/lib/pages/hunger_games/question_card.dart 0.00% <0.00%> (ø)
...ooth_app/lib/pages/hunger_games/question_page.dart 0.99% <0.00%> (-0.08%) ⬇️
...pp/lib/pages/product/common/product_refresher.dart 2.04% <0.00%> (-0.24%) ⬇️
...ges/smooth_app/lib/pages/product/summary_card.dart 0.00% <ø> (ø)
...es/smooth_app/lib/query/barcode_product_query.dart 0.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@AshAman999 AshAman999 left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍

@monsieurtanuki monsieurtanuki merged commit cead249 into openfoodfacts:develop Nov 22, 2022
@monsieurtanuki
Copy link
Contributor Author

Thank you @AshAman999 for your review!

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

Successfully merging this pull request may close these issues.

The product page does not refresh if you click "Continue" after answering a category robotoff question
3 participants