feat/wp-schedule-and-board/main #31
@@ -66,7 +66,15 @@ function readPlan(planFile) {
|
||||
throw new ScriptError('BAD_PLAN', 'workPackages 需為非空陣列');
|
||||
}
|
||||
|
||||
const seen = new Set();
|
||||
for (const wp of plan.workPackages) {
|
||||
// 同一個 index 出現兩次時,相依看的是後者、標題與人天卻取到前者,
|
||||
// 算出來的時程會是兩份定義混出來的東西,而且完全不會報錯
|
||||
if (seen.has(wp.index)) {
|
||||
throw new ScriptError('BAD_PLAN', `工作包 #${wp.index} 在計畫裡出現了不只一次`);
|
||||
}
|
||||
seen.add(wp.index);
|
||||
|
||||
if (!Number.isInteger(wp.index) || wp.index <= 0) {
|
||||
throw new ScriptError('BAD_PLAN', `工作包的 index 需為正整數,收到的是 ${wp.index}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user