« get me outta code hell

content: gAIPTracksChunkedList: album artist only - 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-02-02 18:05:46 -0400
committer(quasar) nebula <qznebula@protonmail.com>2026-02-02 18:05:46 -0400
commit7a5910ad40d7fe36289e8ba3bc749284695cf719 (patch)
tree85c10c5887bcf29292700758427e30e3e3ca0488 /src/common-util
parent653580ff469c88ba3b2a164b6c7114ae592b4588 (diff)
content: gAIPTracksChunkedList: album artist only
Diffstat (limited to 'src/common-util')
-rw-r--r--src/common-util/wiki-data.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/common-util/wiki-data.js b/src/common-util/wiki-data.js
index de34a807..c9c63db7 100644
--- a/src/common-util/wiki-data.js
+++ b/src/common-util/wiki-data.js
@@ -256,13 +256,18 @@ export function getArtistAvatar(artist, {to}) {
 // Used in multiple content functions for the artist info page,
 // because shared logic is torture oooooooooooooooo.
 export function chunkArtistTrackContributions(contributions) {
+  const date = contrib => contrib.date;
+
+  const album = contrib =>
+    (contrib.thing.isTrack
+      ? contrib.thing.album
+      : contrib.thing);
+
   return (
     // First chunk by (contribution) date and album.
     chunkByConditions(contributions, [
-      ({date: date1}, {date: date2}) =>
-        +date1 !== +date2,
-      ({thing: track1}, {thing: track2}) =>
-        track1.album !== track2.album,
+      (a, b) => +date(a) !== +date(b),
+      (a, b) => album(a) !== album(b),
     ]).map(contribs =>
         // Then, *within* the boundaries of the existing chunks,
         // chunk contributions to the same thing together.