fix: exclude non-played songs from recently/most played list

This commit is contained in:
Phan An 2024-01-04 10:16:02 +01:00
parent 9b4f3fb9d2
commit 7f929f5ad6
2 changed files with 11 additions and 2 deletions

View file

@ -44,6 +44,8 @@ export const overviewStore = {
// To keep things simple, we only refresh the song stats.
// All album/artist stats are simply ignored.
this.state.mostPlayedSongs = songStore.getMostPlayed(7)
this.state.recentlyPlayed = recentlyPlayedStore.excerptState.songs.filter(song => !song.deleted)
this.state.recentlyPlayed = recentlyPlayedStore.excerptState.songs.filter(
song => !song.deleted && song.play_count > 0
)
}
}

View file

@ -214,7 +214,14 @@ export const songStore = {
},
getMostPlayed (count: number) {
return take(orderBy(Array.from(this.vault.values()).filter(song => !song.deleted), 'play_count', 'desc'), count)
return take(
orderBy(
Array.from(this.vault.values()).filter(song => !song.deleted && song.play_count > 0),
'play_count',
'desc'
),
count
)
},
async deleteFromFilesystem (songs: Song[]) {