fix(issue9): Checks when no connector at all

This commit is contained in:
sovanna 2020-01-27 16:38:44 +01:00
parent 1d1c626127
commit 80b074102a
2 changed files with 43 additions and 0 deletions

View File

@ -1583,6 +1583,26 @@ class Shop extends React.PureComponent {
}
}
if (idxK.length === 0) {
const slots_need_resource = itemsCloned.slice(0);
const idx_need = slots_need_resource.findIndex(e => (e.rules && e.rules.resources));
if (idx_need != -1) {
if (idx_need in itemsData) {
if ('warnings' in itemsData[idx_need]) {
itemsData[idx_need].warnings.resources = {...itemsCloned[idx_need].rules.resources};
} else {
itemsData[idx_need].warnings = {};
itemsData[idx_need].warnings.resources = {...itemsCloned[idx_need].rules.resources};
}
} else {
itemsData[idx_need] = {...itemsCloned[idx_need]};
itemsData[idx_need].warnings = {};
itemsData[idx_need].warnings.resources = {...itemsCloned[idx_need].rules.resources};
}
}
}
// check number of clock connector available
const idxC = itemsCloned.reduce((prev, next, i) => {

23
static/js/shop.min.js vendored
View File

@ -1624,6 +1624,29 @@ function (_React$PureComponent12) {
rules[ddkali.rules.follow.type] = _objectSpread({}, ddkali.rules.follow);
}
}
}
if (idxK.length === 0) {
var _slots_need_resource = itemsCloned.slice(0);
var _idx_need = _slots_need_resource.findIndex(function (e) {
return e.rules && e.rules.resources;
});
if (_idx_need != -1) {
if (_idx_need in itemsData) {
if ('warnings' in itemsData[_idx_need]) {
itemsData[_idx_need].warnings.resources = _objectSpread({}, itemsCloned[_idx_need].rules.resources);
} else {
itemsData[_idx_need].warnings = {};
itemsData[_idx_need].warnings.resources = _objectSpread({}, itemsCloned[_idx_need].rules.resources);
}
} else {
itemsData[_idx_need] = _objectSpread({}, itemsCloned[_idx_need]);
itemsData[_idx_need].warnings = {};
itemsData[_idx_need].warnings.resources = _objectSpread({}, itemsCloned[_idx_need].rules.resources);
}
}
} // check number of clock connector available