Closed teolemon closed 2 years ago
As far as I understand KP, it looks like the data we get from the server is slightly corrupted.
In particular, for vegan and vegetarian, the elements refer to a panel that does not exists in the rest of the JSON ("ingredients_analysis_help"
). And that's the reason of the crash: a null
panel where we expect one.
Is there something we're missing in Smoothie's parameters that prevents us from getting the "ingredients_analysis_help"
panel? I don't know.
Anyway, we could play it robust and take into consideration the possibility of a null
panel without crashing.
About to PR...
"ingredients_analysis_en:non-vegan": {
"elements": [{
"element_type": "text",
"text_element": {
"html": "\n \n <strong>Ingrédients non végétaliens :</strong>\n Œuf frais, Matière grasse butyrique, Lait en poudre écrémé, Protéine de lait\n \n ",
"type": "summary"
}
}, {
"element_type": "panel",
"panel_element": {
"panel_id": "ingredients_analysis_help"
}
}],
"evaluation": "bad",
"level": "info",
"size": "small",
"title_element": {
"icon_color_from_evaluation": true,
"icon_size": "small",
"icon_url": "https://static.openfoodfacts.org/images/icons/dist/leaf.svg",
"title": "Non végétalien"
},
"topics": ["health"]
},
"ingredients_analysis_en:vegetarian-status-unknown": {
"elements": [{
"element_type": "text",
"text_element": {
"html": "\n \n <strong>Ingrédients non reconnus :</strong>\n Levain\n \n ",
"type": "summary"
}
}, {
"element_type": "panel",
"panel_element": {
"panel_id": "ingredients_analysis_help"
}
}],
"evaluation": "unknown",
"level": "info",
"size": "small",
"title_element": {
"icon_color_from_evaluation": true,
"icon_size": "small",
"icon_url": "https://static.openfoodfacts.org/images/icons/dist/vegetarian.svg",
"title": "Caractère végétarien inconnu"
},
"topics": ["health"]
},
What
Steps to reproduce the behavior
Screenshots