mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
Exclude unknown artist/album from most-played
This commit is contained in:
parent
37b46eb922
commit
82ce986405
2 changed files with 10 additions and 10 deletions
|
@ -147,11 +147,11 @@ export default {
|
|||
* @return {Array.<Object>}
|
||||
*/
|
||||
getMostPlayed(n = 6) {
|
||||
var albums = _.take(_.sortByOrder(this.state.albums, 'playCount', 'desc'), n);
|
||||
// Only non-unknown albums with actually play count are applicable.
|
||||
var applicable = _.filter(this.state.albums, album => {
|
||||
return album.playCount && album.id !== 1;
|
||||
});
|
||||
|
||||
// Remove those with playCount=0
|
||||
_.remove(albums, album => !album.playCount);
|
||||
|
||||
return albums;
|
||||
return _.take(_.sortByOrder(applicable, 'playCount', 'desc'), n);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -150,11 +150,11 @@ export default {
|
|||
* @return {Array.<Object>}
|
||||
*/
|
||||
getMostPlayed(n = 6) {
|
||||
var artists = _.take(_.sortByOrder(this.state.artists, 'playCount', 'desc'), n);
|
||||
// Only non-unknown artists with actually play count are applicable.
|
||||
var applicable = _.filter(this.state.artists, artist => {
|
||||
return artist.playCount && artist.id !== 1;
|
||||
});
|
||||
|
||||
// Remove those with playCount=0
|
||||
_.remove(artists, artist => !artist.playCount);
|
||||
|
||||
return artists;
|
||||
return _.take(_.sortByOrder(applicable, 'playCount', 'desc'), n);
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue