From cab9c96065939705bd6ac4e1bb872484b205f539 Mon Sep 17 00:00:00 2001
From: "(quasar) nebula"
Date: Wed, 24 Mar 2021 19:14:14 -0300
Subject: "contributed music/art to groups" on artist pages
---
upd8.js | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
(limited to 'upd8.js')
diff --git a/upd8.js b/upd8.js
index ace352f..cb0271a 100755
--- a/upd8.js
+++ b/upd8.js
@@ -3061,6 +3061,20 @@ function writeArtistPage(artist) {
const totalReleasedDuration = getTotalDuration(releasedTracks);
+ const countGroups = things => {
+ const usedGroups = things.flatMap(thing => thing.groups || thing.album?.groups || []);
+ return groupData
+ .map(group => ({
+ group,
+ contributions: usedGroups.filter(g => g === group).length
+ }))
+ .filter(({ contributions }) => contributions > 0)
+ .sort((a, b) => b.contributions - a.contributions);
+ };
+
+ const musicGroups = countGroups(releasedTracks);
+ const artGroups = countGroups(artThingsAll);
+
let flashes, flashListChunks;
if (wikiInfo.features.flashesAndGames) {
flashes = C.sortByDate(artist.flashes.asContributor.slice());
@@ -3188,6 +3202,13 @@ function writeArtistPage(artist) {
artist: artist.name,
duration: strings.count.duration(totalReleasedDuration, {approximate: true, unit: true})
})}
+ ${strings('artistPage.musicGroupsLine', {
+ groups: strings.list.unit(musicGroups
+ .map(({ group, contributions }) => strings('artistPage.groupsLine.item', {
+ group: strings.link.groupInfo(group, {to}),
+ contributions: strings.count.contributions(contributions)
+ })))
+ })}
${generateTrackList(releasedTrackListChunks, {strings, to})}
`}
${unreleasedTracks.length && fixWS`
@@ -3202,6 +3223,13 @@ function writeArtistPage(artist) {
text: strings('artistPage.viewArtGallery.link')
})
})}`}
+ ${strings('artistPage.artGroupsLine', {
+ groups: strings.list.unit(artGroups
+ .map(({ group, contributions }) => strings('artistPage.groupsLine.item', {
+ group: strings.link.groupInfo(group, {to}),
+ contributions: strings.count.contributions(contributions)
+ })))
+ })}
${artListChunks.map(({album, chunk}) => fixWS`
- ${strings('artistPage.creditList.album.withDate', {
--
cgit 1.3.0-6-gf8a5