fix(web): ключ нераспределённой строки включает сторону (#206)
I-3: u|<side>|<entry_ids>; тест на две позиции с одинаковыми entry_ids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d76cad1210
commit
b26c1d2581
@ -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');
|
||||
|
||||
@ -130,7 +130,7 @@ export function buildRows(view: ReturnType<typeof filterTable>, 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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user