« get me outta code hell

content: listArtistsByDuration: don't double-count double-credits - 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>2024-05-21 06:42:02 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-21 06:42:20 -0300
commitf151e4266b41fb5dfc7414f98ffb4b9c341cd976 (patch)
tree04b6aada7048ee591ddb1d25390cb930235276ae /src
parent2383ce6c48e499e486e8ede66621af11af237c46 (diff)
content: listArtistsByDuration: don't double-count double-credits
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/listArtistsByDuration.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/content/dependencies/listArtistsByDuration.js b/src/content/dependencies/listArtistsByDuration.js
index f677d82c..66fab8be 100644
--- a/src/content/dependencies/listArtistsByDuration.js
+++ b/src/content/dependencies/listArtistsByDuration.js
@@ -1,5 +1,5 @@
 import {sortAlphabetically, sortByCount} from '#sort';
-import {filterByCount, stitchArrays} from '#sugar';
+import {filterByCount, stitchArrays, unique} from '#sugar';
 import {getTotalDuration} from '#wiki-data';
 
 export default {
@@ -17,10 +17,12 @@ export default {
 
     const durations =
       artists.map(artist =>
-        getTotalDuration([
-          ...(artist.tracksAsArtist ?? []),
-          ...(artist.tracksAsContributor ?? []),
-        ], {originalReleasesOnly: true}));
+        getTotalDuration(
+          unique([
+            ...(artist.tracksAsArtist ?? []),
+            ...(artist.tracksAsContributor ?? []),
+          ]),
+          {originalReleasesOnly: true}));
 
     filterByCount(artists, durations);
     sortByCount(artists, durations, {greatestFirst: true});