@pisell/pisellos 3.0.81 → 3.0.83
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.
|
@@ -1808,7 +1808,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1808
1808
|
timeSlots: timeSlots,
|
|
1809
1809
|
currentCapacity: totalCapacity + (capacity || 0)
|
|
1810
1810
|
});
|
|
1811
|
-
if (canUseTime && !n.onlyComputed && currentResourceIdleTime > targetResourceTime) {
|
|
1811
|
+
if (canUseTime && !n.onlyComputed && currentResourceIdleTime > targetResourceTime && n.capacity >= (capacity || 0)) {
|
|
1812
1812
|
targetResource = n;
|
|
1813
1813
|
targetResourceTime = currentResourceIdleTime;
|
|
1814
1814
|
return 1; // break
|
|
@@ -2203,6 +2203,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2203
2203
|
// 计算容量的辅助函数
|
|
2204
2204
|
var calculateCapacityFromCartItems = function calculateCapacityFromCartItems(items) {
|
|
2205
2205
|
var _items$0$_resourceOri;
|
|
2206
|
+
if (items.length === 0) return 0;
|
|
2206
2207
|
// 还需要增加一个判断,maxCapacity 必须是我单个人里选择的资源只有同一种的情况下才可以累加,否则单个账号都是 1
|
|
2207
2208
|
var firstResource = (_items$0$_resourceOri = items[0]._resourceOrigin) === null || _items$0$_resourceOri === void 0 ? void 0 : _items$0$_resourceOri[0].id;
|
|
2208
2209
|
var sameResourceLength = items.filter(function (item) {
|
|
@@ -2377,6 +2378,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2377
2378
|
// 计算容量的辅助函数
|
|
2378
2379
|
calculateCapacityFromCartItems = function calculateCapacityFromCartItems(items) {
|
|
2379
2380
|
var _items$0$_resourceOri2;
|
|
2381
|
+
if (items.length === 0) return 0;
|
|
2380
2382
|
// 还需要增加一个判断,maxCapacity 必须是我单个人里选择的资源只有同一种的情况下才可以累加,否则单个账号都是 1
|
|
2381
2383
|
var firstResource = (_items$0$_resourceOri2 = items[0]._resourceOrigin) === null || _items$0$_resourceOri2 === void 0 ? void 0 : _items$0$_resourceOri2[0].id;
|
|
2382
2384
|
var sameResourceLength = items.filter(function (item) {
|
|
@@ -2554,8 +2556,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2554
2556
|
_step3;
|
|
2555
2557
|
try {
|
|
2556
2558
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
2559
|
+
var _time$event_list;
|
|
2557
2560
|
var time = _step3.value;
|
|
2558
|
-
var
|
|
2561
|
+
var blockedTimes = (_time$event_list = time.event_list) === null || _time$event_list === void 0 ? void 0 : _time$event_list.filter(function (event) {
|
|
2562
|
+
return event.type !== 'schedule_event';
|
|
2563
|
+
});
|
|
2564
|
+
var _iterator4 = _createForOfIteratorHelper(blockedTimes || []),
|
|
2559
2565
|
_step4;
|
|
2560
2566
|
try {
|
|
2561
2567
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
@@ -349,7 +349,8 @@ export var getResourcesByProduct = function getResourcesByProduct(resourcesMap,
|
|
|
349
349
|
return dayjs(current.end_at).isAfter(dayjs(latest.end_at)) ? current : latest;
|
|
350
350
|
}, d.times[0]);
|
|
351
351
|
// TODO,在这拉时间切片出来,如果可用 timeSlots.length > 1 才可以被选择
|
|
352
|
-
|
|
352
|
+
// 当前资源的配置容量需要大于当前需求的 capacity
|
|
353
|
+
return dayjs(latestTime.end_at).isAfter(dayjs()) && d.capacity >= capacity;
|
|
353
354
|
});
|
|
354
355
|
item.form_id = form_id;
|
|
355
356
|
acc.push(item);
|
|
@@ -1180,7 +1180,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1180
1180
|
timeSlots,
|
|
1181
1181
|
currentCapacity: totalCapacity + (capacity || 0)
|
|
1182
1182
|
});
|
|
1183
|
-
if (canUseTime && !n.onlyComputed && currentResourceIdleTime > targetResourceTime) {
|
|
1183
|
+
if (canUseTime && !n.onlyComputed && currentResourceIdleTime > targetResourceTime && n.capacity >= (capacity || 0)) {
|
|
1184
1184
|
targetResource = n;
|
|
1185
1185
|
targetResourceTime = currentResourceIdleTime;
|
|
1186
1186
|
break;
|
|
@@ -1532,6 +1532,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1532
1532
|
}
|
|
1533
1533
|
const calculateCapacityFromCartItems = (items) => {
|
|
1534
1534
|
var _a2;
|
|
1535
|
+
if (items.length === 0)
|
|
1536
|
+
return 0;
|
|
1535
1537
|
const firstResource = (_a2 = items[0]._resourceOrigin) == null ? void 0 : _a2[0].id;
|
|
1536
1538
|
const sameResourceLength = items.filter((item) => {
|
|
1537
1539
|
var _a3;
|
|
@@ -1665,6 +1667,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1665
1667
|
}
|
|
1666
1668
|
const calculateCapacityFromCartItems = (items) => {
|
|
1667
1669
|
var _a2;
|
|
1670
|
+
if (items.length === 0)
|
|
1671
|
+
return 0;
|
|
1668
1672
|
const firstResource = (_a2 = items[0]._resourceOrigin) == null ? void 0 : _a2[0].id;
|
|
1669
1673
|
const sameResourceLength = items.filter((item) => {
|
|
1670
1674
|
var _a3;
|
|
@@ -1769,10 +1773,12 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1769
1773
|
currentStartTime: currentStartTime2,
|
|
1770
1774
|
times
|
|
1771
1775
|
}) {
|
|
1776
|
+
var _a4;
|
|
1772
1777
|
const currentStart = (0, import_dayjs.default)(currentStartTime2);
|
|
1773
1778
|
let earliestBlockStart;
|
|
1774
1779
|
for (const time of times || []) {
|
|
1775
|
-
|
|
1780
|
+
const blockedTimes = (_a4 = time.event_list) == null ? void 0 : _a4.filter((event) => event.type !== "schedule_event");
|
|
1781
|
+
for (const event of blockedTimes || []) {
|
|
1776
1782
|
const eventStart = (0, import_dayjs.default)(event.start_at);
|
|
1777
1783
|
const eventEnd = (0, import_dayjs.default)(event.end_at);
|
|
1778
1784
|
if (eventStart.isBefore(currentStart) && eventEnd.isAfter(currentStart)) {
|
|
@@ -298,7 +298,7 @@ var getResourcesByProduct = (resourcesMap, resources, selectedResources, capacit
|
|
|
298
298
|
const latestTime = d.times.reduce((latest, current) => {
|
|
299
299
|
return (0, import_dayjs.default)(current.end_at).isAfter((0, import_dayjs.default)(latest.end_at)) ? current : latest;
|
|
300
300
|
}, d.times[0]);
|
|
301
|
-
return (0, import_dayjs.default)(latestTime.end_at).isAfter((0, import_dayjs.default)());
|
|
301
|
+
return (0, import_dayjs.default)(latestTime.end_at).isAfter((0, import_dayjs.default)()) && d.capacity >= capacity;
|
|
302
302
|
});
|
|
303
303
|
item.form_id = form_id;
|
|
304
304
|
acc.push(item);
|