Skip to content

fix: add an explanation for the missing value and unit to a product #11998

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

RayanGoubet
Copy link
Collaborator

What

Add an explanation for the issues that we have a wrong message when we don't have value or unit for a product

Related issue(s) and discussion

@codecov-commenter
Copy link

codecov-commenter commented Jun 4, 2025

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.10%. Comparing base (e8deee5) to head (40d5d37).
⚠️ Report is 401 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
lib/ProductOpener/Display.pm 0.00% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11998      +/-   ##
==========================================
+ Coverage   49.88%   52.10%   +2.21%     
==========================================
  Files          83       90       +7     
  Lines       22984    24057    +1073     
  Branches     5508     5782     +274     
==========================================
+ Hits        11466    12535    +1069     
+ Misses      10121     9903     -218     
- Partials     1397     1619     +222     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -7491,6 +7491,11 @@ msgctxt "action_report_image_to_nutripatrol"
msgid "Report this image to our moderators"
msgstr "Report this image to our moderators"

msgctxt "missing_value_and_or_unit"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to name it missing_serving_size_value_and_or_unit.

@@ -7491,6 +7491,11 @@ msgctxt "action_report_image_to_nutripatrol"
msgid "Report this image to our moderators"
msgstr "Report this image to our moderators"

msgctxt "missing_value_and_or_unit"
msgid "We are missing the serving size value and or unit to calculate the NutriScore"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

``

Suggested change
msgid "We are missing the serving size value and or unit to calculate the NutriScore"
msgid "We are missing the serving size value and/or unit to calculate the Nutri-Score"

Copy link
Contributor

@stephanegigandet stephanegigandet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but we should add a test that show the result of your changes. For instance in test/unit/attributes.t : add a product where we have serving size nutrients, but not the serving size.

@github-actions github-actions bot added 🧪 tests Attributes https://wiki.openfoodfacts.org/Product_Attributes labels Jun 12, 2025
lc => "en",
categories => "biscuits",
categories_tags => ["en:biscuits"],
nutrition_data_per_serving => "20",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be nutrition_data_per => "serving", and then you pass serving_size => "20 g" (or "20" or nothing depending on the case you want to test)

@github-actions github-actions bot added Data import 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers labels Jul 7, 2025
Copy link

sonarqubecloud bot commented Jul 7, 2025

@teolemon teolemon moved this from To discuss and validate to PRs in 🍊 Open Food Facts Server issues Jul 16, 2025
@stephanegigandet
Copy link
Contributor

I wrongly suggested to add a test in attributes.t : the change you made is not visible in attributes, only in the knowledge panels...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Attributes https://wiki.openfoodfacts.org/Product_Attributes Data import Display 💥 Merge Conflicts 💥 Merge Conflicts 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers 🧪 tests 🌐 Translations
Development

Successfully merging this pull request may close these issues.

If the serving size is incorrect, the KP should provide a better explanation
3 participants