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

feat: Automatic numerical sorting of watchedFoldermedia #3338

Closed
wants to merge 7 commits into from
7 changes: 6 additions & 1 deletion src/pages/MediaCalendarPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,11 @@ const generateMediaList = () => {
const combinedMediaItems = [
...datedAdditionalMediaMap.value,
...(selectedDateObject.value?.dynamicMedia ?? []),
...(watchFolderMedia.value?.[selectedDate.value] ?? []),
...(watchFolderMedia.value?.[selectedDate.value] ?? []).sort((a, b) => {
const numA = parseInt(a.title.split(' - ')[0], 10);
const numB = parseInt(b.title.split(' - ')[0], 10);
return numA - numB;
}),
];
if (combinedMediaItems && currentCongregation.value) {
mediaSort.value[currentCongregation.value] ??= {};
Expand Down Expand Up @@ -1579,5 +1583,6 @@ const resetDragging = () => {
currentFile.value = 0;
totalFiles.value = 0;
sectionToAddTo.value = undefined;
generateMediaList(); // Restore the numerical order on reset
};
</script>