« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/composite/things/album/index.js1
-rw-r--r--src/data/composite/things/album/withTrackSections.js21
-rw-r--r--src/data/composite/things/album/withTracks.js9
-rw-r--r--src/data/things/album.js19
4 files changed, 10 insertions, 40 deletions
diff --git a/src/data/composite/things/album/index.js b/src/data/composite/things/album/index.js
index 0ef91b87..8b5098f0 100644
--- a/src/data/composite/things/album/index.js
+++ b/src/data/composite/things/album/index.js
@@ -1,2 +1 @@
-export {default as withTrackSections} from './withTrackSections.js';
 export {default as withTracks} from './withTracks.js';
diff --git a/src/data/composite/things/album/withTrackSections.js b/src/data/composite/things/album/withTrackSections.js
deleted file mode 100644
index a56bda31..00000000
--- a/src/data/composite/things/album/withTrackSections.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import {input, templateCompositeFrom} from '#composite';
-
-import find from '#find';
-
-import {withResolvedReferenceList} from '#composite/wiki-data';
-
-export default templateCompositeFrom({
-  annotation: `withTrackSections`,
-
-  outputs: ['#trackSections'],
-
-  steps: () => [
-    withResolvedReferenceList({
-      list: 'trackSections',
-      data: 'ownTrackSectionData',
-      find: input.value(find.unqualifiedTrackSection),
-    }).outputs({
-      ['#resolvedReferenceList']: '#trackSections',
-    }),
-  ],
-});
diff --git a/src/data/composite/things/album/withTracks.js b/src/data/composite/things/album/withTracks.js
index c8d27c4c..348220e7 100644
--- a/src/data/composite/things/album/withTracks.js
+++ b/src/data/composite/things/album/withTracks.js
@@ -3,7 +3,7 @@ import {input, templateCompositeFrom} from '#composite';
 import {withFlattenedList, withPropertyFromList} from '#composite/data';
 import {withResolvedReferenceList} from '#composite/wiki-data';
 
-import withTrackSections from './withTrackSections.js';
+import {raiseOutputWithoutDependency} from '#composite/control-flow';
 
 export default templateCompositeFrom({
   annotation: `withTracks`,
@@ -11,10 +11,13 @@ export default templateCompositeFrom({
   outputs: ['#tracks'],
 
   steps: () => [
-    withTrackSections(),
+    raiseOutputWithoutDependency({
+      dependency: 'trackSections',
+      output: input.value({'#tracks': []}),
+    }),
 
     withPropertyFromList({
-      list: '#trackSections',
+      list: 'trackSections',
       property: input.value('tracks'),
     }),
 
diff --git a/src/data/things/album.js b/src/data/things/album.js
index ee99c814..f1a7df3d 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -44,6 +44,7 @@ import {
   simpleString,
   singleReference,
   thing,
+  thingList,
   urls,
   wikiData,
 } from '#composite/wiki-properties';
@@ -136,10 +137,8 @@ export class Album extends Thing {
     creditSources: commentary(),
     additionalFiles: additionalFiles(),
 
-    trackSections: referenceList({
-      referenceType: input.value('unqualified-track-section'),
-      data: 'ownTrackSectionData',
-      find: input.value(find.unqualifiedTrackSection),
+    trackSections: thingList({
+      class: input.value(TrackSection),
     }),
 
     artistContribs: contributionList({
@@ -223,10 +222,6 @@ export class Album extends Thing {
       class: input.value(Group),
     }),
 
-    ownTrackSectionData: wikiData({
-      class: input.value(TrackSection),
-    }),
-
     wikiInfo: thing({
       class: input.value(WikiInfo),
     }),
@@ -476,13 +471,7 @@ export class Album extends Thing {
 
         albumData.push(album);
 
-        album.trackSections =
-          trackSections
-            .map(trackSection =>
-              `unqualified-track-section:` +
-              trackSection.unqualifiedDirectory);
-
-        album.ownTrackSectionData = trackSections;
+        album.trackSections = trackSections;
       }
 
       return {albumData, trackSectionData, trackData};