Skip to content

Commit 23ac469

Browse files
committed
minor sorting fixes, bump to version 1.0.6
1 parent f989e0e commit 23ac469

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "community.trakt-tv",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"description": "Addon for getting Trakt's public and user lists, recommendations and watch list.",
55
"main": "server.js",
66
"scripts": {

vue/src/App.vue

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -966,21 +966,17 @@ function getDirection(sort = '', direction = '') {
966966
967967
// Use find() instead of for...in for arrays
968968
const found = Consts.SortDirections.find(option => option.value == sort);
969-
direction = found ? found.name : (direction || 'Descending');
970-
console.log('get direction: ' + direction);
971-
return direction;
969+
return found ? found.name : (direction || 'Ascending');;
972970
}
973971
974972
function getSorting(sort = '') {
975973
sort = sort.split(',').length ? sort.split(',')[0] : sort;
976-
for (let option in Consts.SortOptions) {
977-
if (Consts.SortOptions[option].value == sort) return Consts.SortOptions[option].name;
978-
}
979-
return;
974+
const found = Consts.SortOptions.find(option => option.value == sort);
975+
return found ? found.name : 'Rank';
980976
}
981977
982978
function updateSorting(sort, list) {
983-
if (typeof list.id == 'string' && list.id.startsWith('trakt_')) {
979+
if (list && list.id && typeof list.id == 'string' && list.id.startsWith('trakt_')) {
984980
const index = state.genericLists.indexOf(list);
985981
state.genericLists[index].sort = sort.value;
986982
} else {
@@ -990,11 +986,7 @@ function updateSorting(sort, list) {
990986
}
991987
992988
function updateSortingDirection(direction, list) {
993-
994-
// Convert ID to string for safe comparison
995-
const listId = String(list?.id || '');
996-
997-
if (listId.startsWith('trakt_')) {
989+
if (list && list.id && typeof list.id == 'string' && list.id.startsWith('trakt_')) {
998990
const index = state.genericLists.indexOf(list);
999991
state.genericLists[index].direction = direction.value;
1000992
} else {

0 commit comments

Comments
 (0)