fix(est): reject duplicate quantity sheet codes
This commit is contained in:
@@ -175,7 +175,13 @@ const EstQuantity = (() => {
|
||||
}
|
||||
function allTotals(project) {
|
||||
const combined = new Map();
|
||||
for (const selected of ["manual", ...(project.quantitySheets || []).map((sheet) => sheet.Code)])
|
||||
const codes = (project.quantitySheets || []).map((sheet) => sheet.Code);
|
||||
if (
|
||||
codes.some((code) => typeof code !== "string" || !code || code === "manual") ||
|
||||
new Set(codes).size !== codes.length
|
||||
)
|
||||
throw Error("수량산출서 코드가 없거나 중복됩니다.");
|
||||
for (const selected of ["manual", ...codes])
|
||||
for (const [index, value] of totals(project, selected, true))
|
||||
combined.set(index, (combined.get(index) || 0) + value);
|
||||
if (!combined.size) throw Error("연결할 내역코드를 먼저 입력하세요.");
|
||||
|
||||
Reference in New Issue
Block a user