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 6 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

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 52.37%. Comparing base (e8deee5) to head (b67506b).
Report is 277 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
lib/ProductOpener/Display.pm 20.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11998      +/-   ##
==========================================
+ Coverage   49.88%   52.37%   +2.48%     
==========================================
  Files          83       86       +3     
  Lines       22984    23118     +134     
  Branches     5508     5552      +44     
==========================================
+ Hits        11466    12108     +642     
+ Misses      10121     9450     -671     
- Partials     1397     1560     +163     

☔ 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)

Copy link

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 Display 🧪 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