mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Fix author order when scanning in multi-author books by setting bookAuthor.createdAt when bulk creating #4177
This commit is contained in:
		
							parent
							
								
									ca7388b14e
								
							
						
					
					
						commit
						c7faafd0f3
					
				| @ -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, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user