openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
661 stars 389 forks source link

Quantity units not present #10366

Open bfourgeaud opened 6 months ago

bfourgeaud commented 6 months ago

What

Steps to reproduce the behavior

  1. Check JSON result for La Crème Légère Epaisse 12%MG (https://fr.openfoodfacts.org/cgi/search.pl?search_terms=La%20Cr%C3%A8me%20L%C3%A9g%C3%A8re%20Epaisse%2012%MG&tagtype_0=languages&tag_contains_0=contains&tag_0=fr&tagtype_1=countries&tag_contains_1=contains&tag_1=fr&sort_by=unique_scans_n&page_size=20&json=1)
  2. Check the first item (ou of the 2 results)
  3. Verify that quantityfield is 33 cl
  4. Verify that product_quantityis correcly extracted to the value of 330 (Their was a conversion from cl to ml done server-side)
  5. Verify that product_quantity_unitis not present

Expected behavior

Why

Additional context

This issue does not exist for products that have been updated lately (I edited product 3155250001554 and it has the product_quantity_unitfield)

Type of device

Number of products impacted

Most products that are not in grams

benbenben2 commented 6 months ago

Thanks for reporting it!

I edited and saved the product, and now it appears: https://world.openfoodfacts.org/api/v2/product/3451790439506

Screenshot_20240530_225000

For your information @bfourgeaud, when we apply changes in the code (add translation in the taxonomy, for example, or in this case add a new field in the API (https://github.com/openfoodfacts/openfoodfacts-server/pull/9608)) after deploying the changes in production, it is applied on the products only when they are edited and saved. And in that particular case of the product you mentioned, you need to be moderator because the product was modified by the producer and protected from contributors modifications.