« get me outta code hell

content, data: Divide Flash Lists By Sides - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/Track.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-03-25 11:18:42 -0300
committer(quasar) nebula <qznebula@protonmail.com>2026-03-25 11:18:42 -0300
commit3e5c8f731117b01fdf46c4fe066e1c349dee3827 (patch)
tree503cc42fdb167c2542b8c5b6ec50a06aa112e5bc /src/data/things/Track.js
parent263f32444d5158582520615d9d8520bc562e6918 (diff)
content, data: Divide Flash Lists By Sides
Diffstat (limited to 'src/data/things/Track.js')
-rw-r--r--src/data/things/Track.js39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/data/things/Track.js b/src/data/things/Track.js
index 5cb6388a..36e3733d 100644
--- a/src/data/things/Track.js
+++ b/src/data/things/Track.js
@@ -5,7 +5,7 @@ import {colors} from '#cli';
 import {input, V} from '#composite';
 import find, {keyRefRegex} from '#find';
 import {onlyItem} from '#sugar';
-import {sortByDate} from '#sort';
+import {sortByDate, sortFlashesChronologically} from '#sort';
 import Thing from '#thing';
 import {compareKebabCase} from '#wiki-data';
 
@@ -884,9 +884,44 @@ export class Track extends Thing {
       reverse: soupyReverse.input('tracksWhichSample'),
     }),
 
-    featuredInFlashes: reverseReferenceList({
+    ownFeaturedInFlashes: reverseReferenceList({
       reverse: soupyReverse.input('flashesWhichFeature'),
     }),
+
+    featuredInFlashes: [
+      {
+        dependencies: ['allReleases'],
+        compute: (continuation, {allReleases}) => continuation({
+          ['#data']:
+            allReleases.flatMap(track =>
+              track.ownFeaturedInFlashes.map(flash => ({
+                flash,
+                track,
+
+                // These properties are used for the upcoming sort.
+                act: flash.act,
+                date: flash.date,
+              }))),
+        }),
+      },
+
+      {
+        dependencies: ['#data'],
+        compute: (continuation, {'#data': data}) => continuation({
+          ['#sortedData']:
+            sortFlashesChronologically(data),
+        }),
+      },
+
+      {
+        dependencies: ['#sortedData'],
+        compute: ({'#sortedData': sortedData}) =>
+          sortedData.map(item => ({
+            flash: item.flash,
+            as: item.track,
+          })),
+      },
+    ],
   });
 
   static [Thing.yamlDocumentSpec] = {