Skip to content

Commit

Permalink
fix: don't select nutrition image if one has already been selected
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 committed Jun 21, 2024
1 parent ef96219 commit 035a36b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion robotoff/insights/annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,12 @@ def process_annotation(
description="the image is invalid",
)

image_key = f"nutrition_{insight.value_tag}"

Check warning on line 626 in robotoff/insights/annotate.py

View check run for this annotation

Codecov / codecov/patch

robotoff/insights/annotate.py#L626

Added line #L626 was not covered by tests
# We don't want to select the nutrition image if one has already been
# selected
if image_key in images:
return ALREADY_ANNOTATED_RESULT

Check warning on line 630 in robotoff/insights/annotate.py

View check run for this annotation

Codecov / codecov/patch

robotoff/insights/annotate.py#L629-L630

Added lines #L629 - L630 were not covered by tests

rotation = insight.data.get("rotation", 0)
crop_bounding_box: Optional[tuple[float, float, float, float]] = None
if "bounding_box" in insight.data:
Expand All @@ -635,7 +641,6 @@ def process_annotation(
insight.data["bounding_box"], width, height, rotation
)

image_key = f"nutrition_{insight.value_tag}"
select_rotate_image(
product_id=product_id,
image_id=image_id,
Expand Down

0 comments on commit 035a36b

Please sign in to comment.