diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-08-31 19:13:32 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-09-05 21:02:56 -0300 |
commit | f0a94d03d01220ff44c9c7cf610373781dd4c09d (patch) | |
tree | 0d83f5610696ef81f96955a34c4161e8d418ed57 /src/data/things | |
parent | 56a8e47f0e5ad276baef9d27c16960e3ea2c583b (diff) |
data: refactor Track.coverArtDate
Diffstat (limited to 'src/data/things')
-rw-r--r-- | src/data/things/track.js | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js index ad001445..ad90dd2c 100644 --- a/src/data/things/track.js +++ b/src/data/things/track.js @@ -98,36 +98,15 @@ export class Track extends Thing { // the track's own coverArtDate or its album's trackArtDate, so if neither // is specified, this value is null. coverArtDate: Thing.composite.from(`Track.coverArtDate`, [ - Track.composite.withAlbumProperties({ - properties: [ - 'trackArtDate', - 'trackCoverArtistContribsByRef', - ], - }), + Track.composite.withHasUniqueCoverArt(), + Thing.composite.earlyExitWithoutDependency('#hasUniqueCoverArt', {mode: 'falsy'}), - { - flags: {update: true, expose: true}, + Thing.composite.exposeUpdateValueOrContinue(), + + Track.composite.withAlbumProperty('trackArtDate'), + Thing.composite.exposeDependency('#album.trackArtDate', { update: {validate: isDate}, - expose: { - dependencies: [ - 'coverArtistContribsByRef', - 'disableUniqueCoverArt', - '#album.trackArtDate', - '#album.trackCoverArtistContribsByRef', - ], - - transform(coverArtDate, { - coverArtistContribsByRef, - disableUniqueCoverArt, - '#album.trackArtDate': trackArtDate, - '#album.trackCoverArtistContribsByRef': trackCoverArtistContribsByRef, - }) { - if (disableUniqueCoverArt) return null; - if (empty(coverArtistContribsByRef) && empty(trackCoverArtistContribsByRef)) return null; - return coverArtDate ?? trackArtDate; - }, - }, - } + }), ]), originalReleaseTrackByRef: Thing.common.singleReference(Track), |