diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-06-02 10:55:38 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-12 17:26:54 -0300 |
commit | 5f16db8fc0f2b28f2014c439fb299ab34e7d4b1d (patch) | |
tree | 8b16a92879f67b76b65b49f72f5f6ef61643349d /src/content/dependencies/listArtistsByGroup.js | |
parent | 69479b5bff9b88eab7e4b3e7fe972d7ee773dc36 (diff) |
content, page, util: general contributions usage cleanup
Diffstat (limited to 'src/content/dependencies/listArtistsByGroup.js')
-rw-r--r-- | src/content/dependencies/listArtistsByGroup.js | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/content/dependencies/listArtistsByGroup.js b/src/content/dependencies/listArtistsByGroup.js index f221fe8c..0bf9dd2d 100644 --- a/src/content/dependencies/listArtistsByGroup.js +++ b/src/content/dependencies/listArtistsByGroup.js @@ -1,10 +1,12 @@ import {sortAlphabetically} from '#sort'; + import { empty, filterByCount, filterMultipleArrays, stitchArrays, transposeArrays, + unique, } from '#sugar'; export default { @@ -32,10 +34,27 @@ export default { // (interesting) groups that each of each artists' things belongs to. const artistThingGroups = artists.map(artist => - ([...artist.albumsAsAny.map(album => album.groups), - ...artist.tracksAsAny.map(track => track.album.groups)]) - .map(groups => groups - .filter(group => interestingGroups.includes(group)))); + ([ + (unique( + ([ + artist.albumArtistContributions, + artist.albumCoverArtistContributions, + artist.albumWallpaperArtistContributions, + artist.albumBannerArtistContributions, + ]).flat() + .map(({thing}) => thing) + )).map(album => album.groups), + (unique( + ([ + artist.trackArtistContributions, + artist.trackContributorContributions, + artist.trackCoverArtistContributions, + ]).flat() + .map(({thing}) => thing) + )).map(track => track.album.groups), + ]).flat() + .map(groups => groups + .filter(group => interestingGroups.includes(group)))); const [artistsByGroup, countsByGroup] = transposeArrays(interestingGroups.map(group => { |