« get me outta code hell

data, checks: Track.{referenced,sampled}Tracks: main releases only - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-10-03 19:21:43 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-10-03 19:22:15 -0300
commit84afb5dabf98b8822b3433baca8e02896df04048 (patch)
tree376bb783edce8d34f24e334645f822e1a1624d74 /src
parent7ae1f20d46669be1e8354da1da83888de60814cc (diff)
data, checks: Track.{referenced,sampled}Tracks: main releases only
Cheats a degree of immunity to secrelease shenanigans by making
(musical) track references universally *never* point to a track
with a "Main Release" field (i.e. a seconday release).

Still, #checks continues to detect and error when you're really
pointing to a secondary release, and shouldn't be doing that.
Diffstat (limited to 'src')
-rw-r--r--src/data/checks.js11
-rw-r--r--src/data/things/track.js4
2 files changed, 11 insertions, 4 deletions
diff --git a/src/data/checks.js b/src/data/checks.js
index de433de4..81cbd9a4 100644
--- a/src/data/checks.js
+++ b/src/data/checks.js
@@ -442,9 +442,16 @@ export function filterReferenceErrors(wikiData, {
 
               case '_trackMainReleasesOnly':
                 findFn = trackRef => {
-                  const track = boundFind.track(trackRef);
-                  const mainRef = track && CacheableObject.getUpdateValue(track, 'mainRelease');
+                  let track = boundFind.trackMainReleasesOnly(trackRef, {mode: 'quiet'});
+                  if (track) {
+                    return track;
+                  }
+
+                  // Will error normally, if this can't unambiguously resolve
+                  // or doesn't match any track.
+                  track = boundFind.track(trackRef);
 
+                  const mainRef = CacheableObject.getUpdateValue(track, 'mainRelease');
                   if (mainRef) {
                     // It's possible for the main release to not actually exist, in this case.
                     // It should still be reported since the 'Main Release' field was present.
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 110769e0..1871e86b 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -398,7 +398,7 @@ export class Track extends Thing {
 
       referenceList({
         class: input.value(Track),
-        find: soupyFind.input('track'),
+        find: soupyFind.input('trackMainReleasesOnly'),
       }),
     ],
 
@@ -409,7 +409,7 @@ export class Track extends Thing {
 
       referenceList({
         class: input.value(Track),
-        find: soupyFind.input('track'),
+        find: soupyFind.input('trackMainReleasesOnly'),
       }),
     ],