Skip to content
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: don't select nutrition image if one has already been selected #1348

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
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
Loading