@pisell/pisellos 3.0.33 → 3.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1255,7 +1255,14 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1255
1255
|
var _item$_origin$resourc;
|
|
1256
1256
|
var resources = (_item$_origin$resourc = item._origin.resources) === null || _item$_origin$resourc === void 0 ? void 0 : _item$_origin$resourc.filter(function (m) {
|
|
1257
1257
|
// 检查当前资源是否与目标资源的任何资源匹配
|
|
1258
|
-
|
|
1258
|
+
// 目标资源,应该只取跟当前 m.form_id 相同的资源
|
|
1259
|
+
var sameFormIdResources = targetCartItem._origin.resources.filter(function (n) {
|
|
1260
|
+
return n.form_id === m.form_id;
|
|
1261
|
+
});
|
|
1262
|
+
if (!(sameFormIdResources !== null && sameFormIdResources !== void 0 && sameFormIdResources.length)) {
|
|
1263
|
+
return true;
|
|
1264
|
+
}
|
|
1265
|
+
return !sameFormIdResources.some(function (targetRes) {
|
|
1259
1266
|
// 如果新更新进来的资源不是单个预约,其实就不需要检测了资源重叠了,但是需要检测资源 capacity 是否足够
|
|
1260
1267
|
if (targetRes.resourceType !== 'single') {
|
|
1261
1268
|
var _item$_productOrigin2;
|
|
@@ -1269,10 +1276,10 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1269
1276
|
var originResource = allOriginResources.find(function (n) {
|
|
1270
1277
|
return n.id === targetRes.id;
|
|
1271
1278
|
});
|
|
1272
|
-
if (currentResourcesCapacityMap[
|
|
1279
|
+
if (currentResourcesCapacityMap[m.id] + _currentCapacity > (originResource === null || originResource === void 0 ? void 0 : originResource.capacity)) {
|
|
1273
1280
|
return true;
|
|
1274
1281
|
}
|
|
1275
|
-
currentResourcesCapacityMap[
|
|
1282
|
+
currentResourcesCapacityMap[m.id] += _currentCapacity;
|
|
1276
1283
|
return false;
|
|
1277
1284
|
}
|
|
1278
1285
|
if (item.holder_id !== (targetCartItem === null || targetCartItem === void 0 ? void 0 : targetCartItem.holder_id)) {
|
|
@@ -641,7 +641,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
641
641
|
var _a2;
|
|
642
642
|
if (item._id !== targetCartItem._id) {
|
|
643
643
|
const resources = (_a2 = item._origin.resources) == null ? void 0 : _a2.filter((m) => {
|
|
644
|
-
|
|
644
|
+
const sameFormIdResources = targetCartItem._origin.resources.filter((n) => n.form_id === m.form_id);
|
|
645
|
+
if (!(sameFormIdResources == null ? void 0 : sameFormIdResources.length)) {
|
|
646
|
+
return true;
|
|
647
|
+
}
|
|
648
|
+
return !sameFormIdResources.some((targetRes) => {
|
|
645
649
|
var _a3, _b, _c;
|
|
646
650
|
if (targetRes.resourceType !== "single") {
|
|
647
651
|
const formatCapacity = (0, import_resources.formatDefaultCapacitys)({
|
|
@@ -654,10 +658,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
654
658
|
const originResource = allOriginResources.find(
|
|
655
659
|
(n) => n.id === targetRes.id
|
|
656
660
|
);
|
|
657
|
-
if (currentResourcesCapacityMap[
|
|
661
|
+
if (currentResourcesCapacityMap[m.id] + currentCapacity > (originResource == null ? void 0 : originResource.capacity)) {
|
|
658
662
|
return true;
|
|
659
663
|
}
|
|
660
|
-
currentResourcesCapacityMap[
|
|
664
|
+
currentResourcesCapacityMap[m.id] += currentCapacity;
|
|
661
665
|
return false;
|
|
662
666
|
}
|
|
663
667
|
if (item.holder_id !== (targetCartItem == null ? void 0 : targetCartItem.holder_id)) {
|