-
-
Notifications
You must be signed in to change notification settings - Fork 383
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: warnings modperl_error_log #10344
Conversation
@@ -1,4 +1,27 @@ | |||
[% SET sum_of_bonuses_and_maluses = product.ecoscore_data.adjustments.production_system.value + product.ecoscore_data.adjustments.packaging.value + product.ecoscore_data.adjustments.threatened_species.value + product.ecoscore_data.adjustments.origins_of_ingredients.value %] | |||
[% USE sum_of_bonuses_and_maluses = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that work because if some adjusments are set, and others are not, you will sum the same value multiple times.
But ou can replace this whole part by just this:
[% SET sum_of_bonuses_and_maluses = (product.ecoscore_data.adjustments.production_system.value || 0) + (product.ecoscore_data.adjustments.packaging.value || 0) + (product.ecoscore_data.adjustments.threatened_species.value || 0) + (product.ecoscore_data.adjustments.origins_of_ingredients.value || 0) %]
This suppresses the warnings.
Thank you @benbenben2 !
It's the log over all queries on the production site.
The best way would be to first replicate it locally (by loading the page that you think triggers it, possibly crafting a special product with specific values), and then see if the warning is removed after. Locally you can see the log here: ~/openfoodfacts-server/logs/apache2$ tail -f modperl_error_log |
@@ -25,11 +25,11 @@ | |||
} | |||
}, | |||
[% ELSE %] | |||
[% IF product.ecoscore_data.adjustments.origins_of_ingredients.value <= 0 %] | |||
[% IF defined product.ecoscore_data.adjustments.origins_of_ingredients.value && product.ecoscore_data.adjustments.origins_of_ingredients.value <= 0 %] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an error in the template:
( DIAG ) job 63 failed to fetch template: file error - parse error - api/knowledge-panels/environment/ecoscore/origins_of_ingredients.tt.json line 28: unexpected token (product)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't do [% IF defined something && something <= 0 %] in a template, but instead [% IF something.defined && something <= 0 %]
Co-authored-by: Stéphane Gigandet <[email protected]>
lib/ProductOpener/KnowledgePanels.pm
Outdated
@@ -1334,7 +1339,11 @@ sub create_ingredients_panel ($product_ref, $target_lc, $target_cc, $options_ref | |||
title => $title, | |||
ingredients_text => $ingredients_text, | |||
ingredients_text_with_allergens => $ingredients_text_with_allergens, | |||
ingredients_text_lc => $ingredients_text_lc, | |||
ingredients_text_lc => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why you made that change, but it's breaking the actions in knowledge panels:
-
"edit_field_id" : "ingredients_text_en",
-
"edit_field_id" : "ingredients_text_English",
I will change it back.
lib/ProductOpener/Display.pm
Outdated
@@ -9054,11 +9055,14 @@ sub data_to_display_nutrient_levels ($product_ref) { | |||
|
|||
if ((defined $product_ref->{nutrient_levels}) and (defined $product_ref->{nutrient_levels}{$nid})) { | |||
|
|||
my $nutriment_value = $product_ref->{nutriments}{$nid . $prepared . "_100g"}; | |||
my $formatted_value = $nutriment_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand this part, but it doesn't work:
- "title" : "Salt in high quantity (120%)"
+ "title" : "Salt in high quantity (1.20e+02%)"
Quality Gate passedIssues Measures |
What
attempt to fix warnings modperl_error_log
I believe it should fix
While following should remain:
@stephanegigandet:
Related issue(s) and discussion