« get me outta code hell

only count originals for total duration in most places - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/page
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-11-27 01:30:24 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-11-27 01:30:24 -0400
commit398e8c25073a88cbf7e9861445c87dc9e995978a (patch)
treebd7567bffa6afb23e242be11cc36bc5fd95c810b /src/page
parentdd4e642b381f1af8f235a1eff4eb886b12be31ad (diff)
only count originals for total duration in most places
Diffstat (limited to 'src/page')
-rw-r--r--src/page/artist.js5
-rw-r--r--src/page/group.js2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/page/artist.js b/src/page/artist.js
index 1b5a5060..6dd2ef30 100644
--- a/src/page/artist.js
+++ b/src/page/artist.js
@@ -87,6 +87,7 @@ export function write(artist, {wikiData}) {
         date: +track.date,
         album: track.album,
         duration: track.duration,
+        originalReleaseTrack: track.originalReleaseTrack,
         artists: track.artistContribs.some(({who}) => who === artist)
           ? track.artistContribs.filter(({who}) => who !== artist)
           : track.contributorContribs.filter(({who}) => who !== artist),
@@ -103,11 +104,11 @@ export function write(artist, {wikiData}) {
       date,
       album,
       chunk,
-      duration: getTotalDuration(chunk),
+      duration: getTotalDuration(chunk, {originalReleasesOnly: true}),
     }));
 
   const trackListChunks = chunkTracks(allTracks);
-  const totalDuration = getTotalDuration(allTracks);
+  const totalDuration = getTotalDuration(allTracks.filter(t => !t.originalReleaseTrack));
 
   const countGroups = (things) => {
     const usedGroups = things.flatMap(
diff --git a/src/page/group.js b/src/page/group.js
index c261565b..b181bcb2 100644
--- a/src/page/group.js
+++ b/src/page/group.js
@@ -18,7 +18,7 @@ export function write(group, {wikiData}) {
 
   const {albums} = group;
   const tracks = albums.flatMap((album) => album.tracks);
-  const totalDuration = getTotalDuration(tracks);
+  const totalDuration = getTotalDuration(tracks, {originalReleasesOnly: true});
 
   const albumLines = group.albums.map((album) => ({
     album,