mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-28 14:17:19 +02:00
Update:Sort local books shelf show unfinished books first #302
This commit is contained in:
@@ -56,6 +56,9 @@ export default {
|
|||||||
},
|
},
|
||||||
altViewEnabled() {
|
altViewEnabled() {
|
||||||
return this.$store.getters['getAltViewEnabled']
|
return this.$store.getters['getAltViewEnabled']
|
||||||
|
},
|
||||||
|
localMediaProgress() {
|
||||||
|
return this.$store.state.globals.localMediaProgress
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -69,6 +72,7 @@ export default {
|
|||||||
var podcasts = []
|
var podcasts = []
|
||||||
localMedia.forEach((item) => {
|
localMedia.forEach((item) => {
|
||||||
if (item.mediaType == 'book') {
|
if (item.mediaType == 'book') {
|
||||||
|
item.progress = this.localMediaProgress.find((lmp) => lmp.id === item.id)
|
||||||
books.push(item)
|
books.push(item)
|
||||||
} else if (item.mediaType == 'podcast') {
|
} else if (item.mediaType == 'podcast') {
|
||||||
podcasts.push(item)
|
podcasts.push(item)
|
||||||
@@ -80,7 +84,11 @@ export default {
|
|||||||
id: 'local-books',
|
id: 'local-books',
|
||||||
label: 'Local Books',
|
label: 'Local Books',
|
||||||
type: 'book',
|
type: 'book',
|
||||||
entities: books
|
entities: books.sort((a, b) => {
|
||||||
|
if (a.progress && a.progress.isFinished) return 1
|
||||||
|
else if (b.progress && b.progress.isFinished) return -1
|
||||||
|
return 0
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (podcasts.length) {
|
if (podcasts.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user