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: 5586 - added explicit product type to all relevant background tasks #5721

Merged
merged 4 commits into from
Oct 25, 2024

Conversation

monsieurtanuki
Copy link
Contributor

What

  • All background tasks now have an explicit product type, if relevant.
  • For instance, now we can download offline data for any specific product type.
  • We also display stats about each product type.
  • We don't use implicit product type anymore when we call a server.

Screenshot

Screenshot_1729496007

Fixes bug(s)

Files

New file:

  • work_type.dart: Type of long download work for some background tasks.

Impacted files:

  • background_task.dart: removed the default uriProductHelper getter
  • background_task_barcode.dart: added a uriProductHelper getter that depends on the productType
  • background_task_download_products.dart: refactored the access to product type
  • background_task_full_refresh.dart: split by product type
  • background_task_language_refresh.dart: split by product type
  • background_task_offline.dart: refactored the access to product type
  • background_task_progressing.dart: added the productType parameter; moved code to new WorkType class
  • background_task_top_barcodes.dart: refactored the access to product type
  • dao_product.dart: new methods getProductTypes and splitAllProducts; refactored with product type
  • lazy_counter.dart: explicitly counting the "food" products
  • newsfeed_provider.dart: explicitly getting the news from "food"
  • offline_data_page.dart: now displaying "download top N products" buttons for each product type; stats for each product type
  • offline_tasks_page.dart: enhanced "work text" algo, now depending on product type
  • operation_type.dart: enhanced "key" algo, now depending on product type
  • ordered_nutrients_cache.dart: explicitly using the "food" nutrients
  • product_list_page.dart: now reloading products from their server
  • product_list_popup_items.dart: now linking to the first server with products
  • product_query.dart: made product type a mandatory parameter
  • product_refresher.dart: added mandatory parameter product type
  • random_questions_query.dart: explicitly ask for "food" robotoff products
  • temp_product_list_share_helper.dart: added mandatory parameter product type
  • user_preferences_dev_debug_info.dart: added explicit use of "food" data

…asks

New file:
* `work_type.dart`: Type of long download work for some background tasks.

Impacted files:
* `background_task.dart`: removed the default `uriProductHelper` getter
* `background_task_barcode.dart`: added a `uriProductHelper` getter that depends on the `productType`
* `background_task_download_products.dart`: refactored the access to product type
* `background_task_full_refresh.dart`: split by product type
* `background_task_language_refresh.dart`: split by product type
* `background_task_offline.dart`: refactored the access to product type
* `background_task_progressing.dart`: added the `productType` parameter; moved code to new `WorkType` class
* `background_task_top_barcodes.dart`: refactored the access to product type
* `dao_product.dart`: new methods `getProductTypes` and `splitAllProducts`; refactored with product type
* `lazy_counter.dart`: explicitly counting the "food" products
* `newsfeed_provider.dart`: explicitly getting the news from "food"
* `offline_data_page.dart`: now displaying "download top N products" buttons for each product type; stats for each product type
* `offline_tasks_page.dart`: enhanced "work text" algo, now depending on product type
* `operation_type.dart`: enhanced "key" algo, now depending on product type
* `ordered_nutrients_cache.dart`: explicitly using the "food" nutrients
* `product_list_page.dart`: now reloading products from their server
* `product_list_popup_items.dart`: now linking to the first server with products
* `product_query.dart`: made product type a mandatory parameter
* `product_refresher.dart`: added mandatory parameter product type
* `random_questions_query.dart`: explicitly ask for "food" robotoff products
* `temp_product_list_share_helper.dart`: added mandatory parameter product type
* `user_preferences_dev_debug_info.dart`: added explicit use of "food" data
@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2024

Codecov Report

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

Project coverage is 6.97%. Comparing base (4d9c7fc) to head (4294e5b).
Report is 392 commits behind head on develop.

Files with missing lines Patch % Lines
packages/smooth_app/lib/database/dao_product.dart 0.00% 38 Missing ⚠️
...p/lib/background/background_task_full_refresh.dart 0.00% 16 Missing ⚠️
...ckages/smooth_app/lib/pages/offline_data_page.dart 0.00% 15 Missing ⚠️
...pages/product/common/product_list_popup_items.dart 0.00% 15 Missing ⚠️
packages/smooth_app/lib/background/work_type.dart 0.00% 12 Missing ⚠️
...pp/lib/pages/product/common/product_list_page.dart 0.00% 10 Missing ⚠️
...b/background/background_task_language_refresh.dart 0.00% 9 Missing ⚠️
...pp/lib/background/background_task_progressing.dart 0.00% 5 Missing ⚠️
...kages/smooth_app/lib/pages/offline_tasks_page.dart 0.00% 3 Missing ⚠️
...app/lib/pages/product/ordered_nutrients_cache.dart 0.00% 3 Missing ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #5721      +/-   ##
==========================================
- Coverage     9.54%   6.97%   -2.58%     
==========================================
  Files          325     407      +82     
  Lines        16411   21774    +5363     
==========================================
- Hits          1567    1518      -49     
- Misses       14844   20256    +5412     

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

@teolemon
Copy link
Member

little conflict @monsieurtanuki

@monsieurtanuki monsieurtanuki merged commit be05e60 into openfoodfacts:develop Oct 25, 2024
6 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @teolemon for your reviews!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants