« get me outta code hell

wiki-data: getArtistNumContributions rework - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/common-util
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-04-28 19:44:14 -0300
committer(quasar) nebula <qznebula@protonmail.com>2026-04-28 19:44:53 -0300
commit6c4c1eb9e963aa71a65a7d6f1b2cbdfa0f4416de (patch)
treef703c49a0336d2cf80a4f7ebeb53f2c2adc4b28e /src/common-util
parente6b52c36dc1b705195528f3e1bfaf6e1cbc754d8 (diff)
wiki-data: getArtistNumContributions rework preview
Diffstat (limited to 'src/common-util')
-rw-r--r--src/common-util/wiki-data.js24
1 files changed, 16 insertions, 8 deletions
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);