mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-05-31 20:25:34 -04:00
Fix: double reverse of array
This commit is contained in:
parent
5f105dc6cc
commit
72169990ac
@ -537,14 +537,15 @@ export default {
|
|||||||
let episodeId = null
|
let episodeId = null
|
||||||
const queueItems = []
|
const queueItems = []
|
||||||
if (this.isPodcast) {
|
if (this.isPodcast) {
|
||||||
const episodesInListeningOrder = [...this.sortedEpisodeIds].reverse().map((id) => this.podcastEpisodes.find((ep) => ep.id === id))
|
// Sort the episodes based on the sorting and filtering from the episode table component
|
||||||
console.log('Episodes in listening order', episodesInListeningOrder)
|
const episodesInListeningOrder = this.sortedEpisodeIds.map((id) => this.podcastEpisodes.find((ep) => ep.id === id))
|
||||||
|
|
||||||
// Find most recent episode unplayed
|
// Find the first unplayed episode from the table
|
||||||
let episodeIndex = episodesInListeningOrder.findLastIndex((ep) => {
|
let episodeIndex = episodesInListeningOrder.findIndex((ep) => {
|
||||||
const podcastProgress = this.$store.getters['user/getUserMediaProgress'](this.libraryItemId, ep.id)
|
const podcastProgress = this.$store.getters['user/getUserMediaProgress'](this.libraryItemId, ep.id)
|
||||||
return !podcastProgress || !podcastProgress.isFinished
|
return !podcastProgress || !podcastProgress.isFinished
|
||||||
})
|
})
|
||||||
|
// If all episodes are played, use the first episode
|
||||||
if (episodeIndex < 0) episodeIndex = 0
|
if (episodeIndex < 0) episodeIndex = 0
|
||||||
|
|
||||||
episodeId = episodesInListeningOrder[episodeIndex].id
|
episodeId = episodesInListeningOrder[episodeIndex].id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user