mirror of https://github.com/Kylart/KawAnime.git
Results are now sorted by how many of the tags each result fits
This commit is contained in:
parent
2a544c5569
commit
ee0b4d6cb7
|
@ -31,6 +31,7 @@
|
|||
no-data-text='No data available, did you register your account and set your MyAnimeList public? If yes, it is possible that the account you entered was wrong.',
|
||||
no-results-text='Seems like you haven\'t watched this one ;)',
|
||||
rows-per-page-text='Anime per page:',
|
||||
:disable-initial-sort='true',
|
||||
:loading='isLoading',
|
||||
:headers='headers',
|
||||
:items='lists',
|
||||
|
|
|
@ -34,16 +34,19 @@ export default {
|
|||
start: entry.myStartDate === '0000-00-00' ? null : entry.myStartDate,
|
||||
end: entry.myEndDate === '0000-00-00' ? null : entry.myEndDate,
|
||||
link: 'https://myanimelist.net/anime/' + entry.id + '/' + entry.title,
|
||||
tags: entry.tags || 'No tags'
|
||||
tags: entry.tags || 'No tags',
|
||||
nbCorrespondingTags: 0
|
||||
}
|
||||
|
||||
if (state.tagsFilter.length) {
|
||||
if (toAdd.tags !== 'No tags') {
|
||||
_.each(state.tagsFilter, (tag) => {
|
||||
_.each(toAdd.tags.split(', '), (tag_) => {
|
||||
tag === tag_ && result.push(toAdd)
|
||||
if (tag === tag_) {
|
||||
++toAdd.nbCorrespondingTags
|
||||
result.push(toAdd)
|
||||
}
|
||||
})
|
||||
// _.includes(toAdd.tags, tag) && result.push(toAdd)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
@ -51,6 +54,11 @@ export default {
|
|||
}
|
||||
})
|
||||
|
||||
return _.uniqWith(_.orderBy(result, ['title', 'score'], ['asc', 'desc']), _.isEqual)
|
||||
return _.uniqWith(
|
||||
_.orderBy(
|
||||
result,
|
||||
['nbCorrespondingTags', 'title', 'score'],
|
||||
['desc', 'asc', 'desc']
|
||||
), _.isEqual)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue