davidhealey / waistline

Libre calorie counter app for Android. Built with Cordova.
568 stars 67 forks source link

Use nutrition facts for the prepared product of OFF entries when available #285

Closed EmilJunker closed 3 years ago

EmilJunker commented 3 years ago

Open Food Facts differentiates between "nutrition facts for the product as sold" and "nutrition facts for the prepared product". Most products only specify nutrients "as sold", but for certain items (for example pudding powder), it's much more interesting to get the "prepared product" nutrients as I don't really care how much fat/salt/etc. is in the powder itself. After all, I'm not going to eat the powder but the prepared pudding...

In fact, here is an example of an OFF entry that only specifies nutrition facts for the "prepared product" and has no information about the product "as sold": OFF website: https://world.openfoodfacts.org/product/8710604724739/spaghetti-alla-carbonara-knorr OFF API link: https://world.openfoodfacts.org/api/v0/product/8710604724739.json

When I try to scan the barcode of the above product with Waistline, it says "No matching results". Apparently, you are only checking for the nutrients "as sold" at the moment; and if a product doesn't have them, you ignore it.

I think if an OFF product comes with "nutrition facts for the prepared product", Waistline should use them.

davidhealey commented 3 years ago

Thanks, I'll add it to the list, definitely shouldn't return no matching results.

davidhealey commented 3 years ago

https://github.com/davidhealey/waistline/pull/286