fix(est): preserve notes on added report forms
This commit is contained in:
@@ -1,6 +1,20 @@
|
||||
from test_est_rea_parity import run
|
||||
|
||||
|
||||
def test_custom_print_form_documents_are_saved_and_unknown_keys_rejected():
|
||||
result = run(
|
||||
"math",
|
||||
"""(()=>{
|
||||
const p=EstNative.empty();p.documents={'annual-items':'stage note','progress-costs':'progress note'};
|
||||
const valid=EstModel.validate(p).documents;let rejected=false;
|
||||
const q=EstNative.empty();q.documents={'invalid-key':'bad'};try{EstModel.validate(q)}catch{rejected=true}
|
||||
return {valid,rejected};
|
||||
})()""",
|
||||
)
|
||||
assert result["valid"] == {"annual-items": "stage note", "progress-costs": "progress note"}
|
||||
assert result["rejected"]
|
||||
|
||||
|
||||
def test_schedule_refreshes_progress_from_latest_locked_round_without_losing_dates():
|
||||
result = run(
|
||||
"math",
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
## Codex · EST 독립 테스트 앱 (2026-11-04)
|
||||
- [x] 추가 인쇄 서식의 본문 저장·미리보기·Excel 연결 보완 → 서식 문서 검증·재열기 시험.
|
||||
- 자체 검증: 문서·Excel 시험 24개 통과, Edge에서 본문 저장·재열기·인쇄·Excel 요약 확인.
|
||||
|
||||
- [x] 기성 회차 이름 변경·추가 시 중복 방지 → 공백·기존 이름 충돌 시험.
|
||||
- 자체 검증: 기성·업무 시험 22개 통과, Edge에서 공백 중복 이름 거부·새 이름 생성 확인.
|
||||
|
||||
|
||||
@@ -344,8 +344,21 @@ const EstModel = (() => {
|
||||
if (project.documents != null) {
|
||||
if (typeof project.documents !== "object" || Array.isArray(project.documents))
|
||||
throw Error("문서 본문 형식 오류");
|
||||
const extraForms = new Set([
|
||||
"progress-summary",
|
||||
"progress-costs",
|
||||
"escalation-summary",
|
||||
"escalation-costs",
|
||||
"annual-summary",
|
||||
"annual-items",
|
||||
"change-costs",
|
||||
]);
|
||||
for (const [key, value] of Object.entries(project.documents))
|
||||
if (!/^(current|\d+)$/.test(key) || typeof value !== "string" || value.length > 100000)
|
||||
if (
|
||||
(!/^(current|\d+)$/.test(key) && !extraForms.has(key)) ||
|
||||
typeof value !== "string" ||
|
||||
value.length > 100000
|
||||
)
|
||||
throw Error("문서 본문 형식 오류");
|
||||
}
|
||||
for (const key of ["quantities", "progress", "annual", "drawings", "attachments"]) {
|
||||
|
||||
@@ -106,7 +106,7 @@ const EstReport = (() => {
|
||||
.document-text{white-space:pre-wrap;line-height:1.7;min-height:40mm}.page{break-after:page}.page:last-child{break-after:auto}.footer{text-align:right;margin-top:3mm}
|
||||
</style></head><body><h1>${esc(state.project.name)}</h1><h2>${esc(title)}</h2>
|
||||
${detail ? `<h2>${esc(detail)}</h2>` : ""}${totals ? `<div class="summary">순공사비 ${number(totals.direct?.TC)}원 · 도급액 ${number(totals.total)}원</div>` : ""}
|
||||
${paginate(root, settings)}${errors.length ? `<p class="errors">계산 오류 ${errors.length}건: ${esc(errors.join(" / "))}</p>` : ""}</body></html>`;
|
||||
${paginate(root, settings)}${output && settings.notes ? `<div class="document-text">${esc(settings.notes)}</div>` : ""}${errors.length ? `<p class="errors">계산 오류 ${errors.length}건: ${esc(errors.join(" / "))}</p>` : ""}</body></html>`;
|
||||
EstApp.byId("print-frame").srcdoc = source;
|
||||
}
|
||||
function paginate(root, settings) {
|
||||
@@ -279,7 +279,7 @@ const EstReport = (() => {
|
||||
name: state.project.name,
|
||||
columns,
|
||||
rows,
|
||||
detail: output.detail || "",
|
||||
detail: [output.detail, setting().notes].filter(Boolean).join("\n"),
|
||||
errors: output.errors || [],
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user