« get me outta code hell

data: apply contribution dates when resolving - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-03-07 12:19:19 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-06-12 17:26:40 -0300
commit55df0a77ab929592cce98d36db71315c6c534aa2 (patch)
treed1175659856c72e6e92d517d2337e88c7997473c /src/data/things
parent72f5aafcbb4de53eadef3cd7603856b37ac9cc49 (diff)
data: apply contribution dates when resolving
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/album.js44
-rw-r--r--src/data/things/flash.js4
-rw-r--r--src/data/things/track.js13
3 files changed, 54 insertions, 7 deletions
diff --git a/src/data/things/album.js b/src/data/things/album.js
index 6b37bc96..b0a46af1 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -136,11 +136,45 @@ export class Album extends Thing {
       find: input.value(find.unqualifiedTrackSection),
     }),
 
-    artistContribs: contributionList(),
-    coverArtistContribs: contributionList(),
-    trackCoverArtistContribs: contributionList(),
-    wallpaperArtistContribs: contributionList(),
-    bannerArtistContribs: contributionList(),
+    artistContribs: contributionList({
+      date: 'date',
+    }),
+
+    coverArtistContribs: [
+      withCoverArtDate({
+        fallback: input.value(true),
+      }),
+
+      contributionList({
+        date: '#coverArtDate',
+      }),
+    ],
+
+    trackCoverArtistContribs: contributionList({
+      // May be null, indicating cover art was added for tracks on the date
+      // each track specifies, or else the track's own release date.
+      date: 'trackArtDate',
+    }),
+
+    wallpaperArtistContribs: [
+      withCoverArtDate({
+        fallback: input.value(true),
+      }),
+
+      contributionList({
+        date: '#coverArtDate',
+      }),
+    ],
+
+    bannerArtistContribs: [
+      withCoverArtDate({
+        fallback: input.value(true),
+      }),
+
+      contributionList({
+        date: '#coverArtDate',
+      }),
+    ],
 
     groups: referenceList({
       class: input.value(Group),
diff --git a/src/data/things/flash.js b/src/data/things/flash.js
index 2c0c1417..7d37ed81 100644
--- a/src/data/things/flash.js
+++ b/src/data/things/flash.js
@@ -98,7 +98,9 @@ export class Flash extends Thing {
 
     coverArtDimensions: dimensions(),
 
-    contributorContribs: contributionList(),
+    contributorContribs: contributionList({
+      date: 'date',
+    }),
 
     featuredTracks: referenceList({
       class: input.value(Track),
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 57d2ed20..5410889f 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -194,9 +194,12 @@ export class Track extends Thing {
     artistContribs: [
       inheritContributionListFromOriginalRelease(),
 
+      withDate(),
+
       withResolvedContribs({
         from: input.updateValue({validate: isContributionList}),
         thingProperty: input.thisProperty(),
+        date: '#date',
       }).outputs({
         '#resolvedContribs': '#artistContribs',
       }),
@@ -219,7 +222,10 @@ export class Track extends Thing {
 
     contributorContribs: [
       inheritContributionListFromOriginalRelease(),
-      contributionList(),
+
+      contributionList({
+        date: 'date',
+      }),
     ],
 
     // Cover artists aren't inherited from the original release, since it
@@ -230,9 +236,14 @@ export class Track extends Thing {
         value: input.value([]),
       }),
 
+      withTrackArtDate({
+        fallback: input.value(true),
+      }),
+
       withResolvedContribs({
         from: input.updateValue({validate: isContributionList}),
         thingProperty: input.thisProperty(),
+        date: '#trackArtDate',
       }).outputs({
         '#resolvedContribs': '#coverArtistContribs',
       }),