From d2c8b99b621e8a1cde4cc648437fb2873fc56aaa Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Sat, 21 Oct 2023 13:10:36 -0700 Subject: [PATCH] chore: ranks instead of plays --- config/mediaFilters.js | 4 ++-- src/utils/media.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/mediaFilters.js b/config/mediaFilters.js index 0a25f244..7130358c 100644 --- a/config/mediaFilters.js +++ b/config/mediaFilters.js @@ -12,8 +12,8 @@ module.exports = { } if (item.type === 'artist') { normalized['title'] = item['title'] - normalized['alt'] = `${item['plays']} plays of ${item['title']}` - normalized['subtext'] = `${item['plays']} plays` + normalized['alt'] = `${item['title']} at ${item['rank']}` + normalized['subtext'] = `#${item['rank']}` } if (item.type === 'book' || item.type === 'movie') normalized['alt'] = item['title'] if (item.type === 'tv') { diff --git a/src/utils/media.js b/src/utils/media.js index 5bce372e..adf2a237 100644 --- a/src/utils/media.js +++ b/src/utils/media.js @@ -37,5 +37,5 @@ module.exports = { * @param {Array} array - an array of media objects. * @returns {Array} - a new array sorted by the number of plays in descending order. */ - sortByPlays: (array) => Object.values(array).sort((a, b) => b.plays - a.plays), + sortByPlays: (array) => Object.values(array).sort((a, b) => b.plays - a.plays).map((media, index) => media.rank = index + 1), }