@ray-js/lamp-schedule-core 1.0.4-beta-8 → 1.0.4-beta-9

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.
@@ -6,6 +6,7 @@ import { scheduleLogger } from '../utils/ScheduleLogger';
6
6
  import { checkConflicts } from './ConflictResolver';
7
7
  import { ScheduleDataManager } from './scheduleDataManager';
8
8
  import { transScheduleListToConflictList } from './transform';
9
+ import { EScheduleFunctionType } from '../types';
9
10
 
10
11
  /**
11
12
  * 冲突检测
@@ -58,7 +59,27 @@ export class Conflict {
58
59
  static remove(current) {
59
60
  const [cur] = transScheduleListToConflictList([current]);
60
61
  scheduleLogger.debug('Conflict.remove cur, current:', cur, current);
61
- cur && ScheduleDataManager.getInstance().deleteData(cur);
62
+
63
+ // 如果转换后为空(例如倒计时为0时,status为false会被过滤),需要特殊处理
64
+ if (!cur) {
65
+ // 对于倒计时类型,即使status为false,也需要删除冲突数据(因为倒计时的id是固定的)
66
+ if (current.type === EScheduleFunctionType.COUNTDOWN) {
67
+ const countdownSchedule = {
68
+ id: `${EScheduleFunctionType.COUNTDOWN}`,
69
+ type: EScheduleFunctionType.COUNTDOWN,
70
+ data: {
71
+ status: false,
72
+ weeks: [0, 0, 0, 0, 0, 0, 0],
73
+ startTime: '',
74
+ endTime: ''
75
+ }
76
+ };
77
+ scheduleLogger.debug('Conflict.remove: 倒计时为0,使用固定id删除', countdownSchedule);
78
+ ScheduleDataManager.getInstance().deleteData(countdownSchedule);
79
+ }
80
+ return;
81
+ }
82
+ ScheduleDataManager.getInstance().deleteData(cur);
62
83
  }
63
84
 
64
85
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lamp-schedule-core",
3
- "version": "1.0.4-beta-8",
3
+ "version": "1.0.4-beta-9",
4
4
  "description": "照明计划模块核心能力",
5
5
  "main": "./lib/index.js",
6
6
  "files": [