mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
Sort duplicate scene groups by total filesize descending (#6133)
This commit is contained in:
parent
05e2fb26be
commit
eb816d2e4f
1 changed files with 18 additions and 1 deletions
|
|
@ -79,7 +79,24 @@ export const SceneDuplicateChecker: React.FC = () => {
|
|||
},
|
||||
});
|
||||
|
||||
const scenes = data?.findDuplicateScenes ?? [];
|
||||
const getGroupTotalSize = (group: GQL.SlimSceneDataFragment[]) => {
|
||||
// Sum all file sizes across all scenes in the group
|
||||
return group.reduce((groupTotal, scene) => {
|
||||
const sceneTotal = scene.files.reduce(
|
||||
(fileTotal, file) => fileTotal + file.size,
|
||||
0
|
||||
);
|
||||
return groupTotal + sceneTotal;
|
||||
}, 0);
|
||||
};
|
||||
|
||||
const scenes = useMemo(() => {
|
||||
const groups = data?.findDuplicateScenes ?? [];
|
||||
// Sort by total file size descending (largest groups first)
|
||||
return [...groups].sort((a, b) => {
|
||||
return getGroupTotalSize(b) - getGroupTotalSize(a);
|
||||
});
|
||||
}, [data?.findDuplicateScenes]);
|
||||
|
||||
const { data: missingPhash } = GQL.useFindScenesQuery({
|
||||
variables: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue