From 52ec9d5db7ed68c3ee38481127ab894613d0a416 Mon Sep 17 00:00:00 2001 From: Daniel Asher Resnick Date: Sat, 11 Mar 2023 13:00:51 -0600 Subject: [PATCH] Fix settings logic --- src/public/js/burning.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/public/js/burning.js b/src/public/js/burning.js index 8d32214..090a550 100644 --- a/src/public/js/burning.js +++ b/src/public/js/burning.js @@ -1954,20 +1954,14 @@ function calculateSettingNames($scope, burningData){ // Only settings that are leads from the last lifepath are allowed var lastLifepath = $scope.selectedLifepaths[$scope.selectedLifepaths.length-1]; - // Doing this filtering instead of something like [lastLifepath.setting, ...lastLifepath.leads] - // accomplishes two things: only presents settings present in this server and maintains relative order. + // Doing this filtering instead of [lastLifepath.setting, ...lastLifepath.keyLeads] for two reasons: + // only presents settings present in this server and maintains relative order. $scope.settingNames = $scope.settingNames.filter(s => s == lastLifepath.setting - || (lastLifepath.leads && lastLifepath.leads.includes(s))); + || (Array.isArray(lastLifepath.keyLeads) && lastLifepath.keyLeads.includes(s))); } } - var currentSettingNeedsUpdate = true; - for(var i = 0; i < $scope.settingNames.length; i++){ - if( $scope.settingNames[i] == lastCurrentSetting){ - currentSettingNeedsUpdate = false; - break; - } - } + var currentSettingNeedsUpdate = !$scope.settingNames.includes(lastCurrentSetting); if ( currentSettingNeedsUpdate && $scope.settingNames.length > 0 ){ $scope.currentSetting = $scope.settingNames[0];