diff --git a/web/src/widgets/CorrectionTable/tableModel.test.ts b/web/src/widgets/CorrectionTable/tableModel.test.ts index bf76e37..1f019d2 100644 --- a/web/src/widgets/CorrectionTable/tableModel.test.ts +++ b/web/src/widgets/CorrectionTable/tableModel.test.ts @@ -113,6 +113,19 @@ describe('buildRows и итоги', () => { expect(rows.filter((r) => r.kind === 'entry')).toHaveLength(8); expect(rows.filter((r) => r.kind === 'unallocated')).toHaveLength(t.unallocated.length); }); + it('две позиции нераспределённой строки (Д и К) с одинаковыми entry_ids — разные ключи', () => { + const t = table(); + const base = t.unallocated[0]; + t.unallocated = [ + { ...base, side: 'D', entry_ids: ['e1'] }, + { ...base, side: 'K', entry_ids: ['e1'] }, + ]; + const keys = buildRows(filterTable(t, { ...EMPTY_FILTERS, recordType: 'unallocated' }), new Set()) + .filter((r) => r.kind === 'unallocated') + .map((r) => r.key); + expect(keys).toHaveLength(2); + expect(new Set(keys).size).toBe(2); + }); it('visibleTotals по ЭПТ — ИЛС и правилу 3', () => { const t = table(); const picked = t.aggregates.filter((a) => a.company_1.name === 'ЭПТ' || a.rule_id === 'r3'); diff --git a/web/src/widgets/CorrectionTable/tableModel.ts b/web/src/widgets/CorrectionTable/tableModel.ts index 92b5739..a861b66 100644 --- a/web/src/widgets/CorrectionTable/tableModel.ts +++ b/web/src/widgets/CorrectionTable/tableModel.ts @@ -130,7 +130,7 @@ export function buildRows(view: ReturnType, expanded: Readon rows.push({ kind: 'entry', key: `${key}|${side}|${entry.entry_ids.join(',')}`, parentKey: key, side, entry }); } } - for (const entry of view.unallocated) rows.push({ kind: 'unallocated', key: `u|${entry.entry_ids.join(',')}`, entry }); + for (const entry of view.unallocated) rows.push({ kind: 'unallocated', key: `u|${entry.side}|${entry.entry_ids.join(',')}`, entry }); return rows; }