Fix settings logic

pull/11/head
Daniel Asher Resnick 2 years ago
parent 63a8e05401
commit 52ec9d5db7
  1. 14
      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];

Loading…
Cancel
Save