File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -95,12 +95,32 @@ export class StatsProcessor {
9595 }
9696
9797 getResult ( config : StatsViewConfig ) : ProcessedStats {
98- const topArtists = this . getArtists ( true ) . slice ( 0 , config . artistRankCount ) ;
98+ const allArtists = this . getArtists ( true ) ;
99+ const topArtists = allArtists . slice ( 0 , config . artistRankCount ) ;
99100 const topSongs = this . getSongs ( ) . slice ( 0 , config . songRankCount ) ; // NOTE: songs are sorted upon initialization,
100101
101- const artists = topArtists ;
102+ const artists = [ ... topArtists ] ;
102103 const songs = topSongs ;
103104
105+ for ( const song of songs ) {
106+ let artistFound = false ;
107+
108+ for ( const artist of artists ) {
109+ if ( artist . name == song . artist ) {
110+ artistFound = true ;
111+ break ;
112+ }
113+ }
114+
115+ if ( ! artistFound ) {
116+ for ( const artist of allArtists ) {
117+ if ( artist . name == song . artist ) {
118+ artists . push ( artist ) ;
119+ }
120+ }
121+ }
122+ }
123+
104124 const artistNames : string [ ] = artists . map ( ( a ) => a . name ) ;
105125
106126 const data = {
You can’t perform that action at this time.
0 commit comments