diff --git a/src/js/itemAvailability.js b/src/js/itemAvailability.js index f9303c3303f7a67101b1ee57f21467ad0723e3e4..6dd8dacb0a82b8f85558ab0b3e6047a5b3257531 100644 --- a/src/js/itemAvailability.js +++ b/src/js/itemAvailability.js @@ -299,8 +299,8 @@ window.isClothingAccessible = (function() { console.log(item.rs); Object.keys(item.rs).forEach((requirement) => { if (typeof item.rs === 'object' && item.rs !== null) { + let eitherCheck = 0; if (requirement === "either") { // If we find the "either" nested object, we need to see if just one of the conditions in it are true. - let eitherCheck = 0; Object.keys(item.rs.either).forEach((nestedRequirement) => { if (typeof item.rs.either[nestedRequirement] === 'object' && item.rs.either[nestedRequirement] !== null) { // And yes sometimes even in either we have a nested object, to check V.PC mostly, so check for it. let insideEitherCheck = 0; @@ -319,18 +319,17 @@ window.isClothingAccessible = (function() { eitherCheck++; } } - console.log("Either", eitherCheck); - if (eitherCheck === 0) { - fail = true; - } }); } else { Object.keys(item.rs.either).forEach((nestedRequirement) => { // Otherwise we are probably recording a nested V variable to be checked. - if (V[requirement][nestedRequirement] !== item.rs[requirement][nestedRequirement]) { - return false; + if (V[requirement][nestedRequirement] === item.rs[requirement][nestedRequirement]) { + eitherCheck++; } }); } + if (eitherCheck === 0) { + fail= true; + } } else { if (V[requirement] !== item.rs[requirement]) { fail = true;