diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-06-02 10:55:38 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-18 22:56:06 -0300 |
commit | 4aa153ebae1360e390b9d372fabf457ee8b21705 (patch) | |
tree | a1cff366b439550227fa6ef7b9b4f6c575e51daf /src/content/dependencies/listArtistsByContributions.js | |
parent | 5550f8ec487c3cae87de36f4e0c1fe9d6df8e36c (diff) |
content, page, util: general contributions usage cleanup
Diffstat (limited to 'src/content/dependencies/listArtistsByContributions.js')
-rw-r--r-- | src/content/dependencies/listArtistsByContributions.js | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/content/dependencies/listArtistsByContributions.js b/src/content/dependencies/listArtistsByContributions.js index 0af586cd..41944959 100644 --- a/src/content/dependencies/listArtistsByContributions.js +++ b/src/content/dependencies/listArtistsByContributions.js @@ -1,6 +1,13 @@ import {sortAlphabetically, sortByCount} from '#sort'; -import {empty, filterByCount, filterMultipleArrays, stitchArrays, unique} - from '#sugar'; + +import { + accumulateSum, + empty, + filterByCount, + filterMultipleArrays, + stitchArrays, + unique, +} from '#sugar'; export default { contentDependencies: ['generateListingPage', 'linkArtist'], @@ -38,26 +45,33 @@ export default { 'artistsByTrackContributions', 'countsByTrackContributions', artist => - unique([ - ...artist.tracksAsContributor, - ...artist.tracksAsArtist, - ]).length); + (unique( + ([ + artist.trackArtistContributions, + artist.trackContributorContributions, + ]).flat() + .map(({thing}) => thing) + )).length); queryContributionInfo( 'artistsByArtworkContributions', 'countsByArtworkContributions', artist => - artist.tracksAsCoverArtist.length + - artist.albumsAsCoverArtist.length + - artist.albumsAsWallpaperArtist.length + - artist.albumsAsBannerArtist.length); + accumulateSum( + [ + artist.albumCoverArtistContributions, + artist.albumWallpaperArtistContributions, + artist.albumBannerArtistContributions, + artist.trackCoverArtistContributions, + ], + contribs => contribs.length)); if (sprawl.enableFlashesAndGames) { queryContributionInfo( 'artistsByFlashContributions', 'countsByFlashContributions', artist => - artist.flashesAsContributor.length); + artist.flashContributorContributions.length); } return query; |