Skip to content

Commit

Permalink
fix: avoid duplicated for data quality tags (#9154)
Browse files Browse the repository at this point in the history
* avoid duplicated for data quality tags

* applied comments from Stephane
  • Loading branch information
benbenben2 authored Oct 25, 2023
1 parent e59399e commit 9a0bfba
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/ProductOpener/DataQualityFood.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1409,28 +1409,29 @@ sub check_labels ($product_ref) {
# vegan
if (defined $ingredient_ref->{"vegan"}) {
if ($ingredient_ref->{"vegan"} eq 'no') {
push @{$product_ref->{data_quality_errors_tags}},
"en:vegan-label-but-non-vegan-ingredient";
add_tag($product_ref, "data_quality_errors", "en:vegan-label-but-non-vegan-ingredient");
}
# else 'yes', 'maybe'
}
# no tag
else {
push @{$product_ref->{data_quality_warnings_tags}},
"en:vegan-label-but-could-not-confirm-for-all-ingredients";
add_tag($product_ref, "data_quality_warnings",
"en:vegan-label-but-could-not-confirm-for-all-ingredients");
}
}

# vegetarian
# vegetarian label condition is above
if (defined $ingredient_ref->{"vegetarian"}) {
if ($ingredient_ref->{"vegetarian"} eq 'no') {
push @{$product_ref->{data_quality_errors_tags}},
"en:vegetarian-label-but-non-vegetarian-ingredient";
add_tag($product_ref, "data_quality_errors",
"en:vegetarian-label-but-non-vegetarian-ingredient");
}
# else 'yes', 'maybe'
}
# no tag
else {
push @{$product_ref->{data_quality_warnings_tags}},
"en:vegetarian-label-but-could-not-confirm-for-all-ingredients";
add_tag($product_ref, "data_quality_warnings",
"en:vegetarian-label-but-could-not-confirm-for-all-ingredients");
}
}
}
Expand Down

0 comments on commit 9a0bfba

Please sign in to comment.