diff options
author | (quasar) nebula <towerofnix@gmail.com> | 2021-05-09 11:59:03 -0300 |
---|---|---|
committer | (quasar) nebula <towerofnix@gmail.com> | 2021-05-09 11:59:03 -0300 |
commit | 8cc307d9d06f16f093dacaa08fdc1064d8f996df (patch) | |
tree | 4daef575a97754a02bd12f6333fbb69cb5f07b1f /src | |
parent | cfb940ba021b1974c27b07dd0008b3bf065dad1e (diff) |
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.
Diffstat (limited to 'src')
-rwxr-xr-x | src/upd8.js | 5 |
1 files changed, 3 insertions, 2 deletions
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; |