Change: Multiple authors are treated separately for filtering and searching #103

This commit is contained in:
advplyr 2021-10-31 16:40:27 -05:00
parent d38d4dcd62
commit 2c6cfae6a1
5 changed files with 39 additions and 15 deletions

View file

@ -59,7 +59,7 @@ export const getters = {
if (filter === 'No Series') filtered = filtered.filter(ab => ab.book && !ab.book.series)
else filtered = filtered.filter(ab => ab.book && ab.book.series === filter)
}
else if (group === 'authors') filtered = filtered.filter(ab => ab.book && ab.book.authorFL === filter)
else if (group === 'authors') filtered = filtered.filter(ab => ab.book && ab.book.authorFL && ab.book.authorFL.split(', ').includes(filter))
else if (group === 'narrators') filtered = filtered.filter(ab => ab.book && ab.book.narrator === filter)
else if (group === 'progress') {
filtered = filtered.filter(ab => {
@ -132,8 +132,13 @@ export const getters = {
return seriesArray
},
getUniqueAuthors: (state) => {
var _authors = state.audiobooks.filter(ab => !!(ab.book && ab.book.authorFL)).map(ab => ab.book.authorFL)
return [...new Set(_authors)].sort((a, b) => a.toLowerCase() < b.toLowerCase() ? -1 : 1)
var abAuthors = []
state.audiobooks.forEach((ab) => {
if (ab.book && ab.book.authorFL) {
abAuthors = abAuthors.concat(ab.book.authorFL.split(', '))
}
})
return [...new Set(abAuthors)].sort((a, b) => a.toLowerCase() < b.toLowerCase() ? -1 : 1)
},
getUniqueNarrators: (state) => {
var _narrators = state.audiobooks.filter(ab => !!(ab.book && ab.book.narrator)).map(ab => ab.book.narrator)