From 586c3b9defc0d6222502f43a0cc4fa39c871a018 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 19 Feb 2025 16:47:45 -0400 Subject: 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(). --- src/data/things/track.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/data/things') 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. -- cgit 1.3.0-6-gf8a5