Skip to content

fix(FaceDetectionMapper): Prevent inserting duplicate face detections - #1318

Merged
marcelklehr merged 3 commits into
mainfrom
fix/duplicate-face-detections
Jul 26, 2025
Merged

fix(FaceDetectionMapper): Prevent inserting duplicate face detections#1318
marcelklehr merged 3 commits into
mainfrom
fix/duplicate-face-detections

Conversation

@marcelklehr

@marcelklehr marcelklehr commented Jul 26, 2025

Copy link
Copy Markdown
Member

fixes #1198

  • Add a repair step to remove duplicates

@marcelklehr
marcelklehr requested a review from Copilot July 26, 2025 09:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR prevents the insertion of duplicate face detections by adding a check before inserting new records. The change overrides the insert method to first query for existing face detections with the same file_id, user_id, and bounding box coordinates (x, y, height, width), returning the existing record if found instead of creating a duplicate.

  • Overrides the insert method in FaceDetectionMapper to check for duplicates before insertion
  • Returns existing face detection if a duplicate is found based on file_id, user_id, and coordinates
  • Maintains the same return type while preventing database constraint violations or logical duplicates

Comment thread lib/Db/FaceDetectionMapper.php
Comment thread lib/Db/FaceDetectionMapper.php
Comment thread lib/Db/FaceDetectionMapper.php
@marcelklehr
marcelklehr force-pushed the fix/duplicate-face-detections branch 3 times, most recently from c04f225 to bfea07b Compare July 26, 2025 14:25
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr
marcelklehr force-pushed the fix/duplicate-face-detections branch from bfea07b to c246599 Compare July 26, 2025 14:50
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr
marcelklehr merged commit c25cc96 into main Jul 26, 2025
9 of 14 checks passed
@marcelklehr

Copy link
Copy Markdown
Member Author

/backport to stable10

@marcelklehr

Copy link
Copy Markdown
Member Author

/backport to stable9

@marcelklehr

Copy link
Copy Markdown
Member Author

/backport to stable8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple instances of photos added to People after Recognize is run multiple times, people are merged or faces are added

2 participants