openfoodfacts / smooth-app

🤳🥫 The new Open Food Facts mobile application for Android and iOS, crafted with Flutter and Dart
https://world.openfoodfacts.org/open-food-facts-mobile-app?utm_source=off&utf_medium=web&utm_campaign=github-repo
Apache License 2.0
853 stars 282 forks source link

Comparison to wrong category #2147

Closed teolemon closed 2 years ago

teolemon commented 2 years ago

What

Steps to reproduce the behavior

  1. Scan barcode-3760324840351 - https://world.openfoodfacts.org/product/3760324840351/pate-a-tartiner-chocolat-noisettes-sans-lait-bio-la-fourche
  2. Click on 'Compare to Category'
  3. See error

Expected behavior

Comparison to Hazelnut spreads

Screenshot/Mockup/Before-After

image

monsieurtanuki commented 2 years ago

@teolemon If you have a look at the server data in https://world.openfoodfacts.org/api/v2/product/3760324840351?fields=categories&lc=fr&cc=fr, this is what you get for categories (similar results for categories_tags and https://world.openfoodfacts.org/api/v2/product/3760324840351?fields=categories_tags&lc=fr&cc=f):

As we take the last one - which we assumed to be the most detailed - we take "fr:Vegan". Is that an issue on the server side? Should we here in smoothie take the last English category?

teolemon commented 2 years ago

that's not a simple question, and not as simple as taking the last English category (eg wines) @stephanegigandet @alexgarel any ideas ? we'd basically need a boolean indicating whether the category is taxonomized or not

stephanegigandet commented 2 years ago

As suggested by @teolemon we should pick only a taxonomized category, I will change the code on the server side so that we compare only to taxonomized categories (it's not only the compare button, but also the nutrition facts table knowledge panel).

@monsieurtanuki Can you change the app code so that we don't pick the last one, but the one referenced in the compared_to_category field? https://world.openfoodfacts.org/api/v2/product/3760324840351?fields=categories_tags,compared_to_category&lc=fr&cc=f&

Right not it contains fr:vegan, but I'll change it server side.

stephanegigandet commented 2 years ago

Server side part: https://github.com/openfoodfacts/openfoodfacts-server/issues/6853

stephanegigandet commented 2 years ago

The very short term fix is to remove the category "vegan" from those 25 products. This bug might affect a few more bogus categories, but probably not many products.