From db73aea8a6c1a5943dd8e6f2bd6156ae564c78d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bournhonesque?= Date: Wed, 11 Sep 2024 16:47:07 +0200 Subject: [PATCH] fix: fix bug in spellcheck insights import --- robotoff/insights/importer.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/robotoff/insights/importer.py b/robotoff/insights/importer.py index e04aa3c6ef..4f24769673 100644 --- a/robotoff/insights/importer.py +++ b/robotoff/insights/importer.py @@ -1512,11 +1512,15 @@ def _keep_prediction( return ( # Spellcheck didn't correct prediction.data["original"] != prediction.data["correction"] - # Modification of the original ingredients between two dataset dumps - # (24-hour period) and ( product is None - or prediction.data["original"] != product.ingredients_text + or ( + # Only keep the prediction if the original ingredient is different + # from the current ingredient list + prediction.data["original"] == product.ingredients_text + # Only keep the prediction if it's for the product main language + and prediction.value_tag == product.lang + ) ) )