From 8cc307d9d06f16f093dacaa08fdc1064d8f996df Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 9 May 2021 11:59:03 -0300 Subject: new 'Listed on Homepage' field for albums This does pretty much what it says, though at least for now it only applies to the "New Additions" and "New Releases" rows, not rows set to pull from specific groups. --- src/upd8.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/upd8.js b/src/upd8.js index 3c157d34..d2f736c6 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -1616,6 +1616,7 @@ async function processAlbumDataFile(file) { album.groups = getListField(albumSection, 'Groups') || []; album.directory = getBasicField(albumSection, 'Directory'); album.isMajorRelease = getBooleanField(albumSection, 'Major Release') ?? false; + album.isListedOnHomepage = getBooleanField(albumSection, 'Listed on Homepage') ?? true; if (album.artists && album.artists.error) { return {error: `${album.artists.error} (in ${album.name})`}; @@ -2912,7 +2913,7 @@ function getFlashGridHTML({strings, to, ...props}) { } function getNewReleases(numReleases) { - const latestFirst = albumData.slice().reverse(); + const latestFirst = albumData.filter(album => album.isListedOnHomepage).reverse(); const majorReleases = latestFirst.filter(album => album.isMajorRelease); majorReleases.splice(1); @@ -2936,7 +2937,7 @@ function getNewAdditions(numAlbums) { // Major releases go first to 8etter ensure they show up in the list (and // are usually at the start of the final output for a given d8 of release // too). - const sortedAlbums = albumData.slice().sort((a, b) => { + const sortedAlbums = albumData.filter(album => album.isListedOnHomepage).sort((a, b) => { if (a.dateAdded > b.dateAdded) return -1; if (a.dateAdded < b.dateAdded) return 1; if (a.isMajorRelease && !b.isMajorRelease) return -1; -- cgit 1.3.0-6-gf8a5