From 6c4c1eb9e963aa71a65a7d6f1b2cbdfa0f4416de Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 28 Apr 2026 19:44:14 -0300 Subject: wiki-data: getArtistNumContributions rework --- src/common-util/wiki-data.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/common-util/wiki-data.js') diff --git a/src/common-util/wiki-data.js b/src/common-util/wiki-data.js index 14ae8e96..7130b589 100644 --- a/src/common-util/wiki-data.js +++ b/src/common-util/wiki-data.js @@ -211,15 +211,23 @@ export function getAllTracks(albumData) { export function getArtistNumContributions(artist) { return accumulateSum( [ + // Track artist and contributor contributions, to the same track, + // only count for one. unique( - ([ - artist.trackArtistContributions, - artist.trackContributorContributions, - artist.trackCoverArtistContributions, - ]).flat() - .map(({thing}) => thing)), - - artist.albumCoverArtistContributions, + artist.musicContributions + .map(({thing: track}) => track)), + + // Music video artist and contributor contributions, to the same + // music video, only count for one. + unique( + artist.musicVideoContributions + .map(({thing: musicVideo}) => musicVideo)), + + // Contributions to multiple artworks belonging to the same thing count + // as just as many individual contributions. This includes multiple + // artworks for one track, cover and banner for one album, etc. + artist.artworkContributions, + artist.flashContributorContributions, ], ({length}) => length); -- cgit 1.3.0-6-gf8a5