@pisell/pisellos 0.0.276 → 0.0.277

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.
@@ -2578,12 +2578,18 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
2578
2578
  var mTimes = curr.times.filter(function (n) {
2579
2579
  return !dayjs(n.start_at).isAfter(dayjs(item.start), 'minute') && !dayjs(n.end_at).isBefore(dayjs(item.end), 'minute') || dayjs(n.start_at).isBefore(dayjs(item.end), 'minute') && dayjs(n.end_at).isAfter(dayjs(item.start), 'minute');
2580
2580
  });
2581
+ // 这里为什么要设置个 map,因为有可能日程有重叠,所以要把重叠的 event_list 去除
2582
+ var mSet = new Map();
2581
2583
  mTimes.forEach(function (n) {
2582
- var _n$event_list;
2583
- acc += (_n$event_list = n.event_list) === null || _n$event_list === void 0 ? void 0 : _n$event_list.reduce(function (acc, curr) {
2584
- return acc + curr.pax;
2585
- }, 0);
2584
+ // acc += n.event_list?.reduce((acc: any, curr: any) => acc + curr.pax, 0);
2585
+ // mSet.set(n)
2586
+ n.event_list.forEach(function (m) {
2587
+ mSet.set(m.id, m.pax || 1);
2588
+ });
2586
2589
  });
2590
+ acc += Array.from(mSet.values()).reduce(function (acc, curr) {
2591
+ return acc + curr;
2592
+ }, 0);
2587
2593
  return acc;
2588
2594
  }, 0);
2589
2595
  // 如果已使用容量超过了当前类型资源的容量,则不可用
@@ -1810,10 +1810,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1810
1810
  const mTimes = curr.times.filter((n2) => {
1811
1811
  return !(0, import_dayjs.default)(n2.start_at).isAfter((0, import_dayjs.default)(item.start), "minute") && !(0, import_dayjs.default)(n2.end_at).isBefore((0, import_dayjs.default)(item.end), "minute") || (0, import_dayjs.default)(n2.start_at).isBefore((0, import_dayjs.default)(item.end), "minute") && (0, import_dayjs.default)(n2.end_at).isAfter((0, import_dayjs.default)(item.start), "minute");
1812
1812
  });
1813
+ const mSet = /* @__PURE__ */ new Map();
1813
1814
  mTimes.forEach((n2) => {
1814
- var _a2;
1815
- acc += (_a2 = n2.event_list) == null ? void 0 : _a2.reduce((acc2, curr2) => acc2 + curr2.pax, 0);
1815
+ n2.event_list.forEach((m) => {
1816
+ mSet.set(m.id, m.pax || 1);
1817
+ });
1816
1818
  });
1819
+ acc += Array.from(mSet.values()).reduce((acc2, curr2) => acc2 + curr2, 0);
1817
1820
  return acc;
1818
1821
  }, 0);
1819
1822
  if (sameCartNeedCapacity + otherCartNeedCapacity + usedCapacity >= currentTypeResourcesCapacity) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.276",
4
+ "version": "0.0.277",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",