fix(parse): reject split pier tables and block sheets that fail to build
- E05: a sheet whose pier, IP, or bearing table is not on the same sheet is not selectable (spec 2.2: one sheet per pier) - a sheet is selectable only if every pier in it builds; the reason is shown next to the sheet instead of a selectable sheet with an unchecked pier Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
69922cfa35
commit
4f21bd63bf
3 files changed
+36
No files matched your search
@@ -454,6 +454,12 @@ function updateApply(): void {
|
||||
function loadBytes(bytes: Uint8Array, fileName: string): void {
|
||||
const { piers, sheets } = parseWorkbook(XLSX.read(bytes, { type: 'array' }));
|
||||
const entries = piers.map((input) => buildEntry(input, false));
|
||||
// A sheet is selectable only if every pier in it builds. Show the reason next to the sheet.
|
||||
for (const sheet of sheets) {
|
||||
const own = entries.filter((e) => e.input.sheet === sheet.name);
|
||||
for (const e of own) sheet.issues.push(...e.issues.filter((i) => i.level === 'E'));
|
||||
sheet.ok = sheet.ok && own.every((e) => e.model !== null);
|
||||
}
|
||||
const pending: Pending = { fileName, entries, sheets, preview: null };
|
||||
for (const e of entries) e.checked = selectable(pending, e);
|
||||
pending.preview = entries.find((e) => selectable(pending, e))?.input.name ?? entries[0]?.input.name ?? null;
|
||||
|
||||
Reference in new issue
Block a user