Skip to content

Commit

Permalink
Merge branch 'green' into deploy-green
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanegigandet committed Dec 18, 2024
2 parents 80bea2b + c4494b2 commit 9d74ad0
Show file tree
Hide file tree
Showing 172 changed files with 4,909 additions and 2,164 deletions.
4 changes: 4 additions & 0 deletions conf/nginx/snippets/off.locations-redirects.include
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Redirects for Open Food Facts

location = /nutriscore-v2 {
return 301 https://$host/new-nutriscore;
}

# Donations
# 100 % translated: fr, bg, ca, zh, cs, da, nl, de, he, id, it, lt, pl, pt, ro, ru, es, tr, uk, vi
# EN
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/ProductOpener/Config_obf.pm
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,6 @@ $options{display_tag_ingredients} = [
$options{no_nutrition_table} = 1;

# Name of the Redis stream to which product updates are published
$options{redis_stream_name} = "product_updates_obf";
$options{redis_stream_name} = "product_updates";

1;
2 changes: 1 addition & 1 deletion lib/ProductOpener/Config_off.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ $options{import_export_fields_importance} = {
);

# Name of the Redis stream to which product updates are published
$options{redis_stream_name} = "product_updates_off";
$options{redis_stream_name} = "product_updates";

# used to rename texts and to redirect to the new name
$options{redirect_texts} = {
Expand Down
2 changes: 1 addition & 1 deletion lib/ProductOpener/Config_opf.pm
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,6 @@ $options{attribute_default_preferences_json}
$options{no_nutrition_table} = 1;

# Name of the Redis stream to which product updates are published
$options{redis_stream_name} = "product_updates_opf";
$options{redis_stream_name} = "product_updates";

1;
2 changes: 1 addition & 1 deletion lib/ProductOpener/Config_opff.pm
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,6 @@ $options{attribute_default_preferences_json}
);

# Name of the Redis stream to which product updates are published
$options{redis_stream_name} = "product_updates_opff";
$options{redis_stream_name} = "product_updates";

1;
4 changes: 2 additions & 2 deletions lib/ProductOpener/Food.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,7 @@ sub set_fields_comparing_nutriscore_versions ($product_ref, $version1, $version2
return;
}

=head2 compute_nutriscore( $product_ref )
=head2 compute_nutriscore( $product_ref, $current_version = "2023" )
Determines if we have enough data to compute the Nutri-Score (category + nutrition facts),
and if the Nutri-Score is applicable to the product the category.
Expand All @@ -2110,7 +2110,7 @@ Populates the data structure needed to compute the Nutri-Score and computes it.
=cut

sub compute_nutriscore ($product_ref, $current_version = "2021") {
sub compute_nutriscore ($product_ref, $current_version = "2023") {

# Initialize values

Expand Down
28 changes: 14 additions & 14 deletions po/common/common.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4613,13 +4613,15 @@ msgctxt "attribute_nutriscore_c_description_short"
msgid "Average nutritional quality"
msgstr "Average nutritional quality"

# lower: translate to "less good" in some languages (e.g. French: "Moins bonne qualité nutritionnelle")
msgctxt "attribute_nutriscore_d_description_short"
msgid "Poor nutritional quality"
msgstr "Poor nutritional quality"
msgid "Lower nutritional quality"
msgstr "Lower nutritional quality"

# lower: translate to "less good" in some languages (e.g. French: "Moins bonne qualité nutritionnelle")
msgctxt "attribute_nutriscore_e_description_short"
msgid "Bad nutritional quality"
msgstr "Bad nutritional quality"
msgid "Lower nutritional quality"
msgstr "Lower nutritional quality"

msgctxt "attribute_group_processing_name"
msgid "Food processing"
Expand Down Expand Up @@ -6899,20 +6901,18 @@ msgctxt "nutriscore_new_computation_description"
msgid "<p>The computation of the Nutri-Score is evolving to provide better recommendations based on the latest scientific evidence.</p>"
"<p>Main improvements:</p>"
"<ul>"
"<li>Better differentiation of milks, sweetened dairy drinks and plant-based drinks</li>"
"<li>Better ranking of drinks to favor low-sugar drinks without sweeteners</li>"
"<li>Lower grades for products that contain too much salt or sugar</li>"
"<li>Higher grades for some fatty fish and oils rich in good fats</li>"
"<li>Lower grades for red meat</li>"
"<li>Better score for some fatty fish and oils rich in good fats</li>"
"<li>Better score for whole products rich in fiber</li>"
"<li>Worse score for products containing a lot of salt or sugar</li>"
"<li>Worse score for red meat (compared to poultry)</li>"
"</ul>"
msgstr "<p>The computation of the Nutri-Score is evolving to provide better recommendations based on the latest scientific evidence.</p>"
"<p>Main improvements:</p>"
"<ul>"
"<li>Better differentiation of milks, sweetened dairy drinks and plant-based drinks</li>"
"<li>Better ranking of drinks to favor low-sugar drinks without sweeteners</li>"
"<li>Lower grades for products that contain too much salt or sugar</li>"
"<li>Higher grades for some fatty fish and oils rich in good fats</li>"
"<li>Lower grades for red meat</li>"
"<li>Better score for some fatty fish and oils rich in good fats</li>"
"<li>Better score for whole products rich in fiber</li>"
"<li>Worse score for products containing a lot of salt or sugar</li>"
"<li>Worse score for red meat (compared to poultry)</li>"
"</ul>"

msgctxt "nutriscore_new_computation_link_text"
Expand Down
28 changes: 14 additions & 14 deletions po/common/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -4632,13 +4632,15 @@ msgctxt "attribute_nutriscore_c_description_short"
msgid "Average nutritional quality"
msgstr "Average nutritional quality"

# lower: translate to "less good" in some languages (e.g. French: "Moins bonne qualité nutritionnelle")
msgctxt "attribute_nutriscore_d_description_short"
msgid "Poor nutritional quality"
msgstr "Poor nutritional quality"
msgid "Lower nutritional quality"
msgstr "Lower nutritional quality"

# lower: translate to "less good" in some languages (e.g. French: "Moins bonne qualité nutritionnelle")
msgctxt "attribute_nutriscore_e_description_short"
msgid "Bad nutritional quality"
msgstr "Bad nutritional quality"
msgid "Lower nutritional quality"
msgstr "Lower nutritional quality"

msgctxt "attribute_group_processing_name"
msgid "Food processing"
Expand Down Expand Up @@ -6918,20 +6920,18 @@ msgctxt "nutriscore_new_computation_description"
msgid "<p>The computation of the Nutri-Score is evolving to provide better recommendations based on the latest scientific evidence.</p>"
"<p>Main improvements:</p>"
"<ul>"
"<li>Better differentiation of milks, sweetened dairy drinks and plant-based drinks</li>"
"<li>Better ranking of drinks to favor low-sugar drinks without sweeteners</li>"
"<li>Lower grades for products that contain too much salt or sugar</li>"
"<li>Higher grades for some fatty fish and oils rich in good fats</li>"
"<li>Lower grades for red meat</li>"
"<li>Better score for some fatty fish and oils rich in good fats</li>"
"<li>Better score for whole products rich in fiber</li>"
"<li>Worse score for products containing a lot of salt or sugar</li>"
"<li>Worse score for red meat (compared to poultry)</li>"
"</ul>"
msgstr "<p>The computation of the Nutri-Score is evolving to provide better recommendations based on the latest scientific evidence.</p>"
"<p>Main improvements:</p>"
"<ul>"
"<li>Better differentiation of milks, sweetened dairy drinks and plant-based drinks</li>"
"<li>Better ranking of drinks to favor low-sugar drinks without sweeteners</li>"
"<li>Lower grades for products that contain too much salt or sugar</li>"
"<li>Higher grades for some fatty fish and oils rich in good fats</li>"
"<li>Lower grades for red meat</li>"
"<li>Better score for some fatty fish and oils rich in good fats</li>"
"<li>Better score for whole products rich in fiber</li>"
"<li>Worse score for products containing a lot of salt or sugar</li>"
"<li>Worse score for red meat (compared to poultry)</li>"
"</ul>"

msgctxt "nutriscore_new_computation_link_text"
Expand Down
28 changes: 14 additions & 14 deletions po/common/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -4631,13 +4631,15 @@ msgctxt "attribute_nutriscore_c_description_short"
msgid "Average nutritional quality"
msgstr "Qualité nutritionnelle moyenne"

# lower: translate to "less good" in some languages (e.g. French: "Moins bonne qualité nutritionnelle")
msgctxt "attribute_nutriscore_d_description_short"
msgid "Poor nutritional quality"
msgstr "Mauvaise qualité nutritionnelle"
msgid "Lower nutritional quality"
msgstr "Moins bonne qualité nutritionnelle"

# lower: translate to "less good" in some languages (e.g. French: "Moins bonne qualité nutritionnelle")
msgctxt "attribute_nutriscore_e_description_short"
msgid "Bad nutritional quality"
msgstr "Mauvaise qualité nutritionnelle"
msgid "Lower nutritional quality"
msgstr "Moins bonne qualité nutritionnelle"

msgctxt "attribute_group_processing_name"
msgid "Food processing"
Expand Down Expand Up @@ -6905,20 +6907,18 @@ msgctxt "nutriscore_new_computation_description"
msgid "<p>The computation of the Nutri-Score is evolving to provide better recommendations based on the latest scientific evidence.</p>"
"<p>Main improvements:</p>"
"<ul>"
"<li>Better differentiation of milks, sweetened dairy drinks and plant-based drinks</li>"
"<li>Better ranking of drinks to favor low-sugar drinks without sweeteners</li>"
"<li>Lower grades for products that contain too much salt or sugar</li>"
"<li>Higher grades for some fatty fish and oils rich in good fats</li>"
"<li>Lower grades for red meat</li>"
"<li>Better score for some fatty fish and oils rich in good fats</li>"
"<li>Better score for whole products rich in fiber</li>"
"<li>Worse score for products containing a lot of salt or sugar</li>"
"<li>Worse score for red meat (compared to poultry)</li>"
"</ul>"
msgstr "<p>Le calcul du Nutri-Score évolue pour fournir de meilleures recommandations basées sur les dernières preuves scientifiques.</p>"
"<p>Principales améliorations :</p>"
"<ul>"
"<li>Meilleure différenciation des laits, des boissons lactées sucrées et des boissons végétales</li>"
"<li>Meilleur classement des boissons pour favoriser les boissons peu sucrées sans édulcorants</li>"
"<li>Notes plus basses pour les produits contenant trop de sel ou de sucre</li>"
"<li>Notes plus élevées pour certains poissons gras et huiles riches en bonnes graisses</li>"
"<li>Notes plus basses pour la viande rouge</li>"
"<li>Meilleur score pour certains poissons gras et huiles riches en bonnes graisses</li>"
"<li>Meilleur score pour les produits complets riches en fibres</li>"
"<li>Moins bon score pour les produits contenant beaucoup de sel ou de sucre</li>"
"<li>Moins bon score pour la viande rouge (comparée à la volaille)</li>"
"</ul>"

msgctxt "nutriscore_new_computation_link_text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// Display the link to the new Nutri-Score computation page
// on mobile: keep the /nutriscore-v2 link until the app can handle the new URLs
"html": `
<p>&rarr; <a href="[% IF knowledge_panels_options.knowledge_panels_client == 'web' %]/new-nutri-score[% ELSE %]/nutriscore-v2[% END %]">[% lang('nutriscore_new_computation_link_text') %]</a></p>
<p>&rarr; <a href="[% IF knowledge_panels_options.knowledge_panels_client == 'web' %]/new-nutriscore[% ELSE %]/nutriscore-v2[% END %]">[% lang('nutriscore_new_computation_link_text') %]</a></p>
`
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,8 +915,8 @@
"nova-group" : 4,
"nova-group_100g" : 4,
"nova-group_serving" : 4,
"nutrition-score-fr" : 3,
"nutrition-score-fr_100g" : 3,
"nutrition-score-fr" : 7,
"nutrition-score-fr_100g" : 7,
"proteins" : 4.5,
"proteins_100g" : 4.5,
"proteins_serving" : 0.45,
Expand Down Expand Up @@ -1070,43 +1070,87 @@
"c"
],
"nutriscore_data" : {
"energy" : 400,
"energy_points" : 1,
"energy_value" : 400,
"fiber" : 2,
"fiber_points" : 2,
"fiber_value" : 2,
"fruits_vegetables_nuts_colza_walnut_olive_oils" : 58.3333333333333,
"fruits_vegetables_nuts_colza_walnut_olive_oils_points" : 1,
"fruits_vegetables_nuts_colza_walnut_olive_oils_value" : 58.3,
"components" : {
"negative" : [
{
"id" : "energy",
"points" : 1,
"points_max" : 10,
"unit" : "kJ",
"value" : 400
},
{
"id" : "sugars",
"points" : 3,
"points_max" : 15,
"unit" : "g",
"value" : 12.5
},
{
"id" : "saturated_fat",
"points" : 5,
"points_max" : 10,
"unit" : "g",
"value" : 5.6
},
{
"id" : "salt",
"points" : 0,
"points_max" : 20,
"unit" : "g",
"value" : 0.05
}
],
"positive" : [
{
"id" : "proteins",
"points" : 1,
"points_max" : 7,
"unit" : "g",
"value" : 4.5
},
{
"id" : "fiber",
"points" : 0,
"points_max" : 5,
"unit" : "g",
"value" : 2
},
{
"id" : "fruits_vegetables_legumes",
"points" : 1,
"points_max" : 5,
"unit" : "%",
"value" : 58.3
}
]
},
"count_proteins" : 1,
"count_proteins_reason" : "negative_points_less_than_11",
"grade" : "c",
"is_beverage" : 0,
"is_cheese" : 0,
"is_fat" : 0,
"is_fat_oil_nuts_seeds" : 0,
"is_red_meat_product" : 0,
"is_water" : 0,
"negative_points" : 8,
"positive_points" : 5,
"proteins" : 4.5,
"proteins_points" : 2,
"proteins_value" : 4.5,
"saturated_fat" : 5.6,
"saturated_fat_points" : 5,
"saturated_fat_value" : 5.6,
"score" : 3,
"sodium" : 20.08,
"sodium_points" : 0,
"sodium_value" : 20.1,
"sugars" : 12.5,
"sugars_points" : 2,
"sugars_value" : 12.5
"negative_points" : 9,
"negative_points_max" : 55,
"positive_nutrients" : [
"proteins",
"fiber",
"fruits_vegetables_legumes"
],
"positive_points" : 2,
"positive_points_max" : 17,
"score" : 7
},
"nutriscore_grade" : "c",
"nutriscore_score" : 3,
"nutriscore_score_opposite" : -3,
"nutriscore_score" : 7,
"nutriscore_score_opposite" : -7,
"nutriscore_tags" : [
"c"
],
"nutriscore_version" : "2021",
"nutriscore_version" : "2023",
"nutrition_data" : "on",
"nutrition_data_per" : "100g",
"nutrition_data_prepared_per" : "100g",
Expand Down
Loading

0 comments on commit 9d74ad0

Please sign in to comment.