From c7faafd0f3f03fe75ffca4444e68aa27b3ef57ec Mon Sep 17 00:00:00 2001 From: advplyr Date: Thu, 3 Apr 2025 17:50:10 -0500 Subject: [PATCH] Fix author order when scanning in multi-author books by setting bookAuthor.createdAt when bulk creating #4177 --- server/scanner/BookScanner.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/scanner/BookScanner.js b/server/scanner/BookScanner.js index 1ef6cea9..a1e7ff50 100644 --- a/server/scanner/BookScanner.js +++ b/server/scanner/BookScanner.js @@ -475,6 +475,8 @@ class BookScanner { bookAuthors: [], bookSeries: [] } + + const createdAtTimestamp = new Date().getTime() if (bookMetadata.authors.length) { for (const authorName of bookMetadata.authors) { const matchingAuthorId = await Database.getAuthorIdByName(libraryItemData.libraryId, authorName) @@ -485,6 +487,8 @@ class BookScanner { } else { // New author bookObject.bookAuthors.push({ + // Ensures authors are in a set order + createdAt: createdAtTimestamp + bookObject.bookAuthors.length, author: { libraryId: libraryItemData.libraryId, name: authorName,