mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-05-22 01:18:13 +02:00
feat/fixCrashEmptyCollection
This commit is contained in:
parent
04fb8fa61d
commit
812cb5a160
@ -215,9 +215,10 @@ class FeedEpisode extends Model {
|
|||||||
* @returns {Promise<FeedEpisode[]>}
|
* @returns {Promise<FeedEpisode[]>}
|
||||||
*/
|
*/
|
||||||
static async createFromBooks(books, feed, slug, transaction) {
|
static async createFromBooks(books, feed, slug, transaction) {
|
||||||
const earliestLibraryItemCreatedAt = books.reduce((earliest, book) => {
|
// This is never null unless the books array is empty, as this method is not invoked when no books. Reduce needs an initial item
|
||||||
|
const earliestLibraryItemCreatedAt = books.length > 0 ? books.reduce((earliest, book) => {
|
||||||
return book.libraryItem.createdAt < earliest.libraryItem.createdAt ? book : earliest
|
return book.libraryItem.createdAt < earliest.libraryItem.createdAt ? book : earliest
|
||||||
}).libraryItem.createdAt
|
}).libraryItem.createdAt : null
|
||||||
|
|
||||||
const feedEpisodeObjs = []
|
const feedEpisodeObjs = []
|
||||||
let numExisting = 0
|
let numExisting = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user