« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateArtistInfoPageTracksChunkedList.js35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageTracksChunkedList.js b/src/content/dependencies/generateArtistInfoPageTracksChunkedList.js
index d6ae9ae8..6c953f1a 100644
--- a/src/content/dependencies/generateArtistInfoPageTracksChunkedList.js
+++ b/src/content/dependencies/generateArtistInfoPageTracksChunkedList.js
@@ -19,8 +19,30 @@ export default {
   extraDependencies: ['language'],
 
   query(artist) {
+    const tracksAsArtistAndContributor =
+      artist.tracksAsArtist
+        .filter(track => artist.tracksAsContributor.includes(track));
+
+    const tracksAsArtistOnly =
+      artist.tracksAsArtist
+        .filter(track => !artist.tracksAsContributor.includes(track));
+
+    const tracksAsContributorOnly =
+      artist.tracksAsContributor
+        .filter(track => !artist.tracksAsArtist.includes(track));
+
     const entries = [
-      ...artist.tracksAsArtist.map(track => ({
+      ...tracksAsArtistAndContributor.map(track => ({
+        thing: track,
+        entry: {
+          track,
+          album: track.album,
+          date: track.date,
+          contribs: [...track.artistContribs, ...track.contributorContribs],
+        },
+      })),
+
+      ...tracksAsArtistOnly.map(track => ({
         thing: track,
         entry: {
           track,
@@ -30,7 +52,7 @@ export default {
         },
       })),
 
-      ...artist.tracksAsContributor.map(track => ({
+      ...tracksAsContributorOnly.map(track => ({
         thing: track,
         entry: {
           track,
@@ -102,8 +124,9 @@ export default {
         query.chunks.map(({chunk}) =>
           chunk.map(({contribs}) =>
             contribs
-              .find(({who}) => who === artist)
-              .what)),
+              .filter(({who}) => who === artist)
+              .filter(({what}) => what)
+              .map(({what}) => what))),
 
       trackRereleases:
         query.chunks.map(({chunk}) =>
@@ -166,9 +189,11 @@ export default {
                   }) =>
                     item.slots({
                       otherArtistLinks,
-                      contribution,
                       rerelease,
 
+                      contribution:
+                        language.formatUnitList(contribution),
+
                       content:
                         (duration
                           ? language.$('artistPage.creditList.entry.track.withDuration', {