From bfeae81b6d2ea3b1f53d5bea34be9d8b8c514d82 Mon Sep 17 00:00:00 2001 From: booploops <49113086+booploops@users.noreply.github.com> Date: Tue, 7 Dec 2021 17:21:52 -0800 Subject: [PATCH] fix for sorting by genre --- resources/cider-ui-tests/index.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/resources/cider-ui-tests/index.js b/resources/cider-ui-tests/index.js index cce7a8d2..2609fe69 100644 --- a/resources/cider-ui-tests/index.js +++ b/resources/cider-ui-tests/index.js @@ -83,7 +83,7 @@ const app = new Vue({ "albumName": "Album", "artistName": "Artist", "name": "Name", - "genre": "Genre", + "genreNames": "Genre", "releaseDate": "Release Date", "durationInMillis": "Duration" }, @@ -359,12 +359,14 @@ const app = new Vue({ // sort this.library.songs.displayListing by song.attributes[self.library.songs.sorting] in ascending order based on alphabetical order and numeric order // check if song.attributes[self.library.songs.sorting] is a number and if so, sort by number if not, sort by alphabetical order ignoring case self.library.songs.displayListing.sort((a, b) => { + let aa = null; + let bb = null; if(self.library.songs.sorting == "genre") { aa = a.attributes.genreNames[0] bb = b.attributes.genreNames[0] } - let aa = a.attributes[self.library.songs.sorting] - let bb = b.attributes[self.library.songs.sorting] + aa = a.attributes[self.library.songs.sorting] + bb = b.attributes[self.library.songs.sorting] if (aa == null) { aa = "" } @@ -382,12 +384,14 @@ const app = new Vue({ // sort this.library.songs.displayListing by song.attributes[self.library.songs.sorting] in descending order based on alphabetical order and numeric order // check if song.attributes[self.library.songs.sorting] is a number and if so, sort by number if not, sort by alphabetical order ignoring case self.library.songs.displayListing.sort((a, b) => { - if(self.library.songs.sorting == "genre") { + let aa = null; + let bb = null; + if(self.library.songs.sorting == "genreNames") { aa = a.attributes.genreNames[0] bb = b.attributes.genreNames[0] } - let aa = a.attributes[self.library.songs.sorting] - let bb = b.attributes[self.library.songs.sorting] + aa = a.attributes[self.library.songs.sorting] + bb = b.attributes[self.library.songs.sorting] if (aa == null) { aa = "" }