chore: ranks instead of plays

This commit is contained in:
Cory Dransfeldt 2023-10-21 13:10:36 -07:00
parent be0c6396ad
commit d2c8b99b62
2 changed files with 3 additions and 3 deletions

View file

@ -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),
}