-
-
Notifications
You must be signed in to change notification settings - Fork 400
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: deduce 0 sugar/sat fat to compute nutriscore #7947
Conversation
where fat is 0 we can deduce saturated fat is 0, same for sugar from carbohydrates we use it to compute nutriscore
lib/ProductOpener/Food.pm
Outdated
# we have two special case where we can deduce data | ||
next | ||
if (saturated_fat_0_because_of_fat_0($product_ref, $prepared) | ||
|| sugar_0_because_of_carbohydrates_0($product_ref, $prepared)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will fail if you don't have both saturated_fat and sugars, but you have 1 of carbohydrates == 0 or fat == 0. You will get a Nutri-Score even though you can deduce only one of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that ok @stephanegigandet (I added a test, so that should do)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not able to review in details, but looks good to me.
I completely agree with this first step.
Kudos, SonarCloud Quality Gate passed! |
where fat is 0 we can deduce saturated fat is 0, same for sugar from carbohydrates we use it to compute Nutri-Score
Fixes: