mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-20 13:53:19 +01:00
Fix FeedEpisodes using a new ID when updating #3757
This commit is contained in:
@@ -98,11 +98,22 @@ class RssFeedManager {
|
||||
podcastId: feed.entity.mediaId
|
||||
},
|
||||
attributes: ['id', 'updatedAt'],
|
||||
order: [['createdAt', 'DESC']]
|
||||
order: [['updatedAt', 'DESC']]
|
||||
})
|
||||
|
||||
if (mostRecentPodcastEpisode && mostRecentPodcastEpisode.updatedAt > newEntityUpdatedAt) {
|
||||
newEntityUpdatedAt = mostRecentPodcastEpisode.updatedAt
|
||||
}
|
||||
} else {
|
||||
const book = await Database.bookModel.findOne({
|
||||
where: {
|
||||
id: feed.entity.mediaId
|
||||
},
|
||||
attributes: ['id', 'updatedAt']
|
||||
})
|
||||
if (book && book.updatedAt > newEntityUpdatedAt) {
|
||||
newEntityUpdatedAt = book.updatedAt
|
||||
}
|
||||
}
|
||||
|
||||
return newEntityUpdatedAt > feed.entityUpdatedAt
|
||||
@@ -111,7 +122,7 @@ class RssFeedManager {
|
||||
attributes: ['id', 'updatedAt'],
|
||||
include: {
|
||||
model: Database.bookModel,
|
||||
attributes: ['id'],
|
||||
attributes: ['id', 'updatedAt'],
|
||||
through: {
|
||||
attributes: []
|
||||
},
|
||||
@@ -125,8 +136,9 @@ class RssFeedManager {
|
||||
let newEntityUpdatedAt = feed.entity.updatedAt
|
||||
|
||||
const mostRecentItemUpdatedAt = feed.entity.books.reduce((mostRecent, book) => {
|
||||
if (book.libraryItem.updatedAt > mostRecent) {
|
||||
return book.libraryItem.updatedAt
|
||||
let updatedAt = book.libraryItem.updatedAt > book.updatedAt ? book.libraryItem.updatedAt : book.updatedAt
|
||||
if (updatedAt > mostRecent) {
|
||||
return updatedAt
|
||||
}
|
||||
return mostRecent
|
||||
}, 0)
|
||||
|
||||
Reference in New Issue
Block a user