diff options
Diffstat (limited to 'src/data/composite/things/track')
| -rw-r--r-- | src/data/composite/things/track/index.js | 1 | ||||
| -rw-r--r-- | src/data/composite/things/track/withAllReleases.js | 57 | ||||
| -rw-r--r-- | src/data/composite/things/track/withOtherReleases.js | 8 |
3 files changed, 2 insertions, 64 deletions
diff --git a/src/data/composite/things/track/index.js b/src/data/composite/things/track/index.js index 61807018..17e4aeff 100644 --- a/src/data/composite/things/track/index.js +++ b/src/data/composite/things/track/index.js @@ -2,7 +2,6 @@ export {default as alwaysReferenceByDirectory} from './alwaysReferenceByDirector export {default as exitWithoutUniqueCoverArt} from './exitWithoutUniqueCoverArt.js'; export {default as inheritContributionListFromMainRelease} from './inheritContributionListFromMainRelease.js'; export {default as inheritFromMainRelease} from './inheritFromMainRelease.js'; -export {default as withAllReleases} from './withAllReleases.js'; export {default as withDirectorySuffix} from './withDirectorySuffix.js'; export {default as withOtherReleases} from './withOtherReleases.js'; export {default as withPropertyFromAlbum} from './withPropertyFromAlbum.js'; diff --git a/src/data/composite/things/track/withAllReleases.js b/src/data/composite/things/track/withAllReleases.js deleted file mode 100644 index 078209a9..00000000 --- a/src/data/composite/things/track/withAllReleases.js +++ /dev/null @@ -1,57 +0,0 @@ -// Gets all releases of the current track. All items of the outputs are -// distinct Track objects; one track is the main release; all else are -// secondary releases of that main release; and one item, which may be -// the main release or one of the secondary releases, is the current -// track. The results are sorted by date, and it is possible that the -// main release is not actually the earliest/first. - -import {input, templateCompositeFrom} from '#composite'; -import {sortByDate} from '#sort'; - -import {withPropertyFromObject} from '#composite/data'; - -export default templateCompositeFrom({ - annotation: `withAllReleases`, - - outputs: ['#allReleases'], - - steps: () => [ - { - dependencies: [ - 'mainReleaseTrack', - 'secondaryReleases', - input.myself(), - ], - - compute: (continuation, { - mainReleaseTrack, - secondaryReleases, - [input.myself()]: thisTrack, - }) => - (mainReleaseTrack - ? continuation({ - ['#mainReleaseTrack']: mainReleaseTrack, - ['#secondaryReleaseTracks']: mainReleaseTrack.secondaryReleases, - }) - : continuation({ - ['#mainReleaseTrack']: thisTrack, - ['#secondaryReleaseTracks']: secondaryReleases, - })), - }, - - { - dependencies: [ - '#mainReleaseTrack', - '#secondaryReleaseTracks', - ], - - compute: (continuation, { - ['#mainReleaseTrack']: mainReleaseTrack, - ['#secondaryReleaseTracks']: secondaryReleaseTracks, - }) => continuation({ - ['#allReleases']: - sortByDate([mainReleaseTrack, ...secondaryReleaseTracks]), - }), - }, - ], -}); diff --git a/src/data/composite/things/track/withOtherReleases.js b/src/data/composite/things/track/withOtherReleases.js index bb3e8983..ccf57deb 100644 --- a/src/data/composite/things/track/withOtherReleases.js +++ b/src/data/composite/things/track/withOtherReleases.js @@ -3,21 +3,17 @@ import {input, templateCompositeFrom} from '#composite'; -import withAllReleases from './withAllReleases.js'; - export default templateCompositeFrom({ annotation: `withOtherReleases`, outputs: ['#otherReleases'], steps: () => [ - withAllReleases(), - { - dependencies: [input.myself(), '#allReleases'], + dependencies: [input.myself(), 'allReleases'], compute: (continuation, { [input.myself()]: thisTrack, - ['#allReleases']: allReleases, + ['allReleases']: allReleases, }) => continuation({ ['#otherReleases']: allReleases.filter(track => track !== thisTrack), |