-
-
Notifications
You must be signed in to change notification settings - Fork 406
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: petfood-nutrition-facts #11188
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #11188 +/- ##
==========================================
- Coverage 49.18% 49.14% -0.04%
==========================================
Files 78 78
Lines 22389 22404 +15
Branches 5371 5378 +7
==========================================
Hits 11011 11011
- Misses 10020 10034 +14
- Partials 1358 1359 +1 ☔ View full report in Codecov by Sentry. |
/update_tests_results |
@benbenben2 awesome work! Thank a lot for looking into this! I'm a bit wary of adding the _1kg suffix. I think an alternative would be to keep the _100g internally, so that we can keep the code closer to the food code. Maybe we could discuss it in the product opener meeting, or in another call? |
front for product as well as for edit remains per 1 kg. API is rolled back to be per 100g. There is changes in Food and Display to switch from front to api (divide by 10) and from api to front (multiply by 10), respectively. function name is rolled back from xxg to 100g |
/lint |
/lint |
|
What
Based on EU regulations:
https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX%3A02009R0767-20181226&qid=1734788661215
Nutrition for pet food products is somewhat different than for human food.
There are 3 types of nutriments in pet food nutrition facts
Suggested solution is to use existing nutrition tables as defined in Food.pm (see %nutriments_tables) but split into 2 off_ and opff_.
A few
if petfood ... else ...
have been introduced. Another option might have been to make it more generic and use setup in ProductsFeatures, but that would have been more complex.There might be future minor improvements (for the future) such as:
Since the nutriments not given in % are given in mg/kg, nutriments suffix can be _1kg and not only _100g (see screenshot of the API below). Also compute_nutrition_data_per_100g_and_per_serving is renamed compute_nutrition_data_per_xxg_and_per_serving,
Fixes:
comment:
There is a bit of confusion in variables naming because product_type is used for both
- flavor product type (petfood, food, beauty, products)
- nutrition fact quantity/measurement type like in
foreach my $product_type ("", "_prepared") {
Screenshot
BEFORE
![Screenshot_20250103_234833](https://private-user-images.githubusercontent.com/110821832/400091820-c27fda6d-4adb-41d5-a069-be7f19d4fa94.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMTIyNDYsIm5iZiI6MTczOTIxMTk0NiwicGF0aCI6Ii8xMTA4MjE4MzIvNDAwMDkxODIwLWMyN2ZkYTZkLTRhZGItNDFkNS1hMDY5LWJlN2YxOWQ0ZmE5NC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxODI1NDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wOTU1YmU2OGU0N2JlMjdlNWYxMzBjMmQ2YTE2ZjRjNzY5OTFmZGJmYjQ2YWRhMDA0MDIwZjc1MGIxNTA5ZTFkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ltwNMkgkmZugdQ-iJmL-8EY__pyGGL8ijEHPO2YDRcQ)
AFTER
![Screenshot_20250103_234753](https://private-user-images.githubusercontent.com/110821832/400091812-afc605d5-4602-4f88-8fdb-a7dce7d01820.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMTIyNDYsIm5iZiI6MTczOTIxMTk0NiwicGF0aCI6Ii8xMTA4MjE4MzIvNDAwMDkxODEyLWFmYzYwNWQ1LTQ2MDItNG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lOGVkNDY5MTY3MTBjNWYwNmZkMjNjNzc1YmE3ZmE3ODk2NGExJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.N2QkQQfU79TR0ZOdsNEI1AjfcMqmWsxvMDtEtkajDno)
![Screenshot_20250103_234911](https://private-user-images.githubusercontent.com/110821832/400091788-2d1f24e7-ea6f-4193-a4be-781497c24f84.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMTIyNDYsIm5iZiI6MTczOTIxMTk0NiwicGF0aCI6Ii8xMTA4MjE4MzIvNDAwMDkxNzg4LTJkMWYyNGU3LWVhNmYtNDE5My1hNGJlLTc4MTQ5N2MyNGY4NC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxODI1NDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02NDcyMmEzNjdkNjBjNGM4OTZjZWQ4MzI1NjJkM2Q2ZDUxNWNlMGJiNDI5MTg1NWMzNjQ3ZjgwNDAxNjgzMThkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.-n0Ye0RB0bbEvKnfEdFBcRgOIC6-s0squhmD9qaQcuc)
Related issue(s) and discussion