From f151e4266b41fb5dfc7414f98ffb4b9c341cd976 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 21 May 2024 06:42:02 -0300 Subject: content: listArtistsByDuration: don't double-count double-credits --- src/content/dependencies/listArtistsByDuration.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/content') 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}); -- cgit 1.3.0-6-gf8a5