feat(rebar): piece lengths for C9–C13 and P1·P2 so the 재료표 has no missing bars
A row can now carry pieces (length, count). C9, C10, C11 and C9·C11 사이 have U and 삿갓 pieces per position (3 loops each); C12 and C13 have 일자 and ㄷ pieces per bar; P1 and P2 have their splice pieces, each counting all the bars. The 재료표 totals from the pieces, so no bar is left out. 개수 stays the 철근표 count; the piece count is kept beside it. The 삿갓 length h − 100 is an assumption (Q-K5) and is noted on the ④ screen. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
99c71b7277
commit
e999b11a21
6 files changed
+98
-23
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { buildPier } from '../src/core/geometry';
|
||||
import { DEFAULT_MATERIAL } from '../src/core/rebar/common';
|
||||
import { buildQuantity } from '../src/core/rebar/quantity';
|
||||
import { rebarSummary, type RebarRow } from '../src/core/rebar/summary';
|
||||
import { loadP1 } from './helpers';
|
||||
|
||||
const rows = rebarSummary(buildPier(loadP1())).rows;
|
||||
const row = (name: string): RebarRow => rows.find((r) => r.name === name)!;
|
||||
const total = (r: RebarRow) => r.pieces!.reduce((s, p) => s + p.count * p.length, 0);
|
||||
const bars = (r: RebarRow) => r.pieces!.reduce((s, p) => s + p.count, 0);
|
||||
const hasLength = (r: RebarRow, mm: number, tol = 3) => r.pieces!.some((p) => Math.abs(p.length - mm) < tol);
|
||||
|
||||
describe('조각 길이 (승인 2026-10-23): 여러 길이를 가진 행', () => {
|
||||
it('C9 and C11 pieces: U (3522 first, 6098 last) and 삿갓, 3 loops each; 108 bars per row', () => {
|
||||
for (const name of ['C9', 'C11']) {
|
||||
expect(row(name).pieces, name).toBeDefined();
|
||||
expect(bars(row(name)), name).toBe(108);
|
||||
expect(hasLength(row(name), 3522), name).toBe(true);
|
||||
expect(hasLength(row(name), 6098), name).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it('C10 pieces: outer U 6249 and Level U 6340; 54 bars', () => {
|
||||
expect(bars(row('C10'))).toBe(54);
|
||||
expect(hasLength(row('C10'), 6249)).toBe(true);
|
||||
expect(hasLength(row('C10'), 6340)).toBe(true);
|
||||
});
|
||||
|
||||
it('C12 and C13 pieces: the bars per row equal the row count (4 per position)', () => {
|
||||
expect(bars(row('C12'))).toBe(row('C12').count);
|
||||
expect(bars(row('C13'))).toBe(row('C13').count);
|
||||
expect(total(row('C12'))).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('P1 and P2 pieces: each splice piece counts all the bars (230)', () => {
|
||||
expect(row('P1').pieces!.every((p) => p.count === 230)).toBe(true);
|
||||
expect(row('P2').pieces!.every((p) => p.count === 230)).toBe(true);
|
||||
expect(row('P1').pieces!.length).toBeGreaterThan(1);
|
||||
});
|
||||
|
||||
it('the 재료표 no longer leaves out any P1 bar: no missing bars', () => {
|
||||
const q = buildQuantity(rows, DEFAULT_MATERIAL);
|
||||
expect(q.missing).toEqual([]);
|
||||
expect(q.groups.flatMap((g) => g.diameters.flatMap((d) => d.lines.map((l) => l.name)))).toEqual(expect.arrayContaining(['C9', 'C10', 'C11', 'C12', 'P1', 'P2']));
|
||||
});
|
||||
});
|
||||
@@ -22,11 +22,10 @@ describe('철근재료표 (승인 2026-10-23)', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('bars with no length yet are listed as missing and kept out of the totals', () => {
|
||||
it('a row with several lengths is totalled from its pieces, not left out', () => {
|
||||
const q = buildQuantity(rows, DEFAULT_MATERIAL);
|
||||
expect(q.missing).toContain('C9');
|
||||
expect(q.missing).toContain('C11');
|
||||
expect(q.groups.flatMap((g) => g.diameters.flatMap((d) => d.lines.map((l) => l.name)))).not.toContain('C9');
|
||||
expect(q.missing).toEqual([]);
|
||||
expect(q.groups.flatMap((g) => g.diameters.flatMap((d) => d.lines.map((l) => l.name)))).toContain('C9');
|
||||
});
|
||||
|
||||
it('couplers are counted, not weighed', () => {
|
||||
|
||||
@@ -53,7 +53,8 @@ describe('③ 철근표 요약 (P1)', () => {
|
||||
});
|
||||
|
||||
it('lengths from the documents: C13 11746, C14 3447.5, C15 3852, C16 4070, P3 ≈ C_t + 1.3·l_d, P5 ≈ C_t', () => {
|
||||
expect(rows.find((r) => r.name === 'C13')!.length).toBe(11746);
|
||||
// C13 has several lengths now: its straight bars are pieces (수정 2026-10-23); 11746 is the first 일자.
|
||||
expect(rows.find((r) => r.name === 'C13')!.pieces!.some((p) => p.length === 11746)).toBe(true);
|
||||
expect(rows.find((r) => r.name === 'C14')!.length).toBe(3447.5);
|
||||
expect(rows.find((r) => r.name === 'C15')!.length).toBe(3852);
|
||||
expect(rows.find((r) => r.name === 'C16')!.length).toBe(4070);
|
||||
|
||||
Reference in new issue
Block a user