diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-02-19 16:47:45 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-03-02 08:24:12 -0400 |
commit | 586c3b9defc0d6222502f43a0cc4fa39c871a018 (patch) | |
tree | 3bbd9cc289b0c29e126a2aceec30ef3b6636bb9f /src/data/things/track.js | |
parent | 76e508ffe3818a78fb941ecde05fe9c269e8bc22 (diff) |
data: miscellaneous cleanup for withOtherReleases logic
Defines withOtherReleases in terms of new function withAllReleases (also exposed as Track.allReleases), in turn based on new property Track.secondaryReleases (of the main release), which is a reverse ref list, reverse.tracksWhichAreSecondaryReleasesOf().
Diffstat (limited to 'src/data/things/track.js')
-rw-r--r-- | src/data/things/track.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js index 6ac417b5..69eb98a5 100644 --- a/src/data/things/track.js +++ b/src/data/things/track.js @@ -63,6 +63,7 @@ import { inheritContributionListFromMainRelease, inheritFromMainRelease, withAlbum, + withAllReleases, withAlwaysReferenceByDirectory, withContainingTrackSection, withDate, @@ -419,6 +420,17 @@ export class Track extends Thing { }), ], + // Only has any value for main releases, because secondary releases + // are never secondary to *another* secondary release. + secondaryReleases: reverseReferenceList({ + reverse: soupyReverse.input('tracksWhichAreSecondaryReleasesOf'), + }), + + allReleases: [ + withAllReleases(), + exposeDependency({dependency: '#allReleases'}), + ], + otherReleases: [ withOtherReleases(), exposeDependency({dependency: '#otherReleases'}), @@ -679,6 +691,13 @@ export class Track extends Thing { referencing: track => [track], referenced: track => track.commentatorArtists, }, + + tracksWhichAreSecondaryReleasesOf: { + bindTo: 'trackData', + + referencing: track => track.isSecondaryRelease ? [track] : [], + referenced: track => [track.mainReleaseTrack], + }, }; // Track YAML loading is handled in album.js. |