Skip to content

Commit 9b6a861

Browse files
committed
feat(ui): improve duplicate checker select options and fix resolution check
Renamed the dropdown options in the duplicate checkers to be much clearer about their behavior (e.g. 'Keep the largest file'). Also fixed a bug in the Image Duplicate Checker where 'select highest resolution' would fail or do nothing because 'checkSameResolution' was incorrectly trying to access array index [0] on visual_files instead of finding the max resolution across all files, causing it to incorrectly abort the selection.
1 parent de06341 commit 9b6a861

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

ui/v2.5/src/components/ImageDuplicateChecker/ImageDuplicateChecker.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,12 @@ const ImageDuplicateChecker: React.FC = () => {
250250
};
251251

252252
function checkSameResolution(dataGroup: GQL.SlimImageDataFragment[]) {
253-
const resolutions = dataGroup.map(
254-
(s) => (s.visual_files[0]?.width ?? 0) * (s.visual_files[0]?.height ?? 0)
255-
);
253+
const resolutions = dataGroup.map((s) => {
254+
return s.visual_files.reduce(
255+
(prev, f) => Math.max(prev, (f.height ?? 0) * (f.width ?? 0)),
256+
0
257+
);
258+
});
256259
return new Set(resolutions).size === 1;
257260
}
258261

ui/v2.5/src/locales/en-GB.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,12 +1136,12 @@
11361136
"medium": "Medium"
11371137
},
11381138
"search_accuracy_label": "Search Accuracy",
1139-
"select_all_but_largest_file": "Select every file in each duplicated group, except the largest file",
1140-
"select_all_but_largest_resolution": "Select every file in each duplicated group, except the file with highest resolution",
1139+
"select_all_but_largest_file": "Keep the largest file (select all but the largest)",
1140+
"select_all_but_largest_resolution": "Keep the highest resolution file (select all but the highest resolution)",
11411141
"select_none": "Select None",
1142-
"select_oldest": "Select the oldest file in the duplicate group",
1142+
"select_oldest": "Keep the oldest file (select all but the oldest)",
11431143
"select_options": "Select Options…",
1144-
"select_youngest": "Select the youngest file in the duplicate group",
1144+
"select_youngest": "Keep the youngest file (select all but the youngest)",
11451145
"title": "Duplicate Scenes"
11461146
},
11471147
"duplicated": "Duplicated",

0 commit comments

Comments
 (0)