« get me outta code hell

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:
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/track.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js
index d2930ff1..0842bf23 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -164,17 +164,26 @@ export class Track extends Thing {
       update: {validate: isDate},
 
       expose: {
-        dependencies: ['albumData', 'dateFirstReleased'],
+        dependencies: [
+          'albumData',
+          'coverArtistContribsByRef',
+          'dateFirstReleased',
+          'hasCoverArt',
+        ],
         transform: (coverArtDate, {
           albumData,
+          coverArtistContribsByRef,
           dateFirstReleased,
+          hasCoverArt,
           [Track.instance]: track,
         }) =>
-          coverArtDate ??
-          dateFirstReleased ??
-          Track.findAlbum(track, albumData)?.trackArtDate ??
-          Track.findAlbum(track, albumData)?.date ??
-          null,
+          (Track.hasCoverArt(track, albumData, coverArtistContribsByRef, hasCoverArt)
+            ? coverArtDate ??
+              dateFirstReleased ??
+              Track.findAlbum(track, albumData)?.trackArtDate ??
+              Track.findAlbum(track, albumData)?.date ??
+              null
+            : null),
       },
     },