Skip to content
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

fix: Nutri Score Nutriments with an asterisk #8205

Merged
merged 13 commits into from
Mar 20, 2023

Conversation

MonalikaPatnaik
Copy link
Collaborator

What

So, to calculate nutriscore-- fats,saturated-fats, sugar and salt are the required nutriments to be considered, so I have made necessary changes in the code to show these nutriments with an asterisk in the nutrition table:)

Screenshot

Screenshot 2023-03-14 205358

Related issue(s) and discussion

@MonalikaPatnaik MonalikaPatnaik requested a review from a team as a code owner March 14, 2023 17:52
@github-actions github-actions bot added ✏️ Editing Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. labels Mar 14, 2023
Copy link
Contributor

@jnsereko jnsereko left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @MonalikaPatnaik
fix some formatting issue though

@teolemon teolemon added the 🚦Nutri-Score https://world.openfoodfacts.org/nutriscore label Mar 15, 2023
@@ -207,7 +207,11 @@ <h1>[% title %]</h1>
<td>
<!--label starts-->
[% IF nutriment.name.defined %]
<label class="nutriment_label" for="nutriment_[% nutriment.enid %]">[% nutriment.prefix %][% nutriment.name %]</label>
[% IF nutriment.nid == 'fat' || nutriment.nid == 'saturated-fat' || nutriment.nid == 'salt'|| nutriment.nid =='sugars' %]
Copy link
Contributor

Choose a reason for hiding this comment

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

energy in kJ and fibers are also used for the Nutri-Score.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @MonalikaPatnaik , thanks for the PR!

If we put a *, we need to explicitly tell users what this * means, otherwise there is no way to guess. Could you add a string after the table that states "*: used to compute the Nutri-Score" or similar?

That string would need to be translatable, so you would need to use the lang() function, and add it in the translation files: po/common/common.pot + po/common/en.po

Thanks for the review..will make necessary changes :)

@stephanegigandet
Copy link
Contributor

stephanegigandet commented Mar 15, 2023

Hi @MonalikaPatnaik , thanks for the PR!

If we put a *, we need to explicitly tell users what this * means, otherwise there is no way to guess.
Could you add a string after the table that states "*: used to compute the Nutri-Score" or similar?

That string would need to be translatable, so you would need to use the lang() function, and add it in the translation files: po/common/common.pot + po/common/en.po

…html

Co-authored-by: jnsereko <58003327+jnsereko@users.noreply.github.com>
@github-actions github-actions bot removed the 🚦Nutri-Score https://world.openfoodfacts.org/nutriscore label Mar 15, 2023
@github-actions github-actions bot added CSS 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org labels Mar 16, 2023
po/common/en.po Outdated Show resolved Hide resolved
Co-authored-by: Stéphane Gigandet <stephane@openfoodfacts.org>
Copy link
Contributor

@yuktea yuktea left a comment

Choose a reason for hiding this comment

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

tested it out 👍
you should probably remove the extra changes that got staged

@MonalikaPatnaik
Copy link
Collaborator Author

tested it out 👍 you should probably remove the extra changes that got staged

Okay..Thanks<3

@MonalikaPatnaik
Copy link
Collaborator Author

MonalikaPatnaik commented Mar 17, 2023

Heyy..done the req changes..check once!! Should I squash the commits into one!

@@ -25,6 +25,7 @@ <h1>[% title %]</h1>
[% END %]

[% IF errors_index >=0 %]
<p>[% lang("correct_the_following_errors") %]</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

This string has been added twice

@@ -59,6 +60,9 @@ <h1>[% title %]</h1>
<p id="barcode_paragraph"> [% lang("barcode") %][% sep %]:
<span id="barcode" property="food:code" itemprop="gtin13" style="speak-as:digits;">[% code %]</span>
</p>
<p id="barcode_paragraph"> [% lang("barcode") %][% sep %]:
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, strings have been added twice

@@ -209,7 +213,11 @@ <h1>[% title %]</h1>
<td>
<!--label starts-->
[% IF nutriment.name.defined %]
[% IF nutriment.nid == 'energy-kj' || nutriment.nid == 'saturated-fat' || nutriment.nid == 'salt'|| nutriment.nid =='sugars' || nutriment.nid == 'fiber' %]
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 missing fat (needed for some food categories) and proteins

@@ -117,7 +117,7 @@ nb:Fett i liten kvantitet
nd:Fat in low quantity
ne:Fat in low quantity
ng:Fat in low quantity
nl:Vetten in kleine hoeveelheid
nl:Vetten in low quantity
Copy link
Contributor

Choose a reason for hiding this comment

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

can you remove the changes in this file? they are unrelated...

you can do "git checkout taxonomies/nutrient_levels.txt" to get back the original file

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@yuktea yuktea self-requested a review March 17, 2023 14:47
Copy link
Contributor

@yuktea yuktea left a comment

Choose a reason for hiding this comment

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

Thank you for making the changes to it Monalika.
Like I said in the previous comment, you should remove the unrelated changed taxonomy file.

@MonalikaPatnaik
Copy link
Collaborator Author

Thank you for making the changes to it Monalika. Like I said in the previous comment, you should remove the unrelated changed taxonomy file.

Yup..I have discarded the changes and commited the previous state of the file only

@yuktea
Copy link
Contributor

yuktea commented Mar 17, 2023

Yup..I have discarded the changes and commited the previous state of the file only

I don't think it should be a problem. but it's still showing up in your changed file diff even when there is no apparent change.
I'd say as a general rule, only stage those files that you need to commit. 🙂

Edit: you might have to do a force-push to get that file out from changed files. but I really don't think it matters here since there seems to be no apparent change.

@yuktea
Copy link
Contributor

yuktea commented Mar 17, 2023

Above is just a nit-pick. This should be good to merge I believe. Thank you so much! 💯

@MonalikaPatnaik
Copy link
Collaborator Author

Yup..I have discarded the changes and commited the previous state of the file only

I don't think it should be a problem. but it's still showing up in your changed file diff even when there is no apparent change. I'd say as a general rule, only stage those files that you need to commit. 🙂

Edit: you might have to do a force-push to get that file out from changed files. but I really don't think it matters here since there seems to be no apparent change.

Okay..I'll keep this in mind..if u say I could squash all my commits into one having the necessary changed files only!

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, thank you for addressing all the comments @MonalikaPatnaik!

@stephanegigandet stephanegigandet merged commit 4ba6017 into openfoodfacts:main Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS ✏️ Editing 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In Edit Mode, indicate the required nutriments to compute the Nutri-Score by an asterisk
5 participants