improvement: treatment plan turned into a wizard. shift+click control added to FDI tooth chart for cunnected prosthesises.

This commit is contained in:
2026-07-17 00:39:32 +03:30
parent cf07b4d8a8
commit 68fc9d5d6d
28 changed files with 1461 additions and 477 deletions

View File

@@ -11,6 +11,7 @@ function buildMockTx(options: {
treatmentDetailId: string;
tooth: string;
prosthesisTypeCode: string;
selectionGroupId?: string;
treatmentType?: string;
}>;
prosthesisTypes: Array<{
@@ -35,9 +36,11 @@ function buildMockTx(options: {
treatmentDetailId: row.treatmentDetailId,
tooth: row.tooth,
prosthesisTypeCode: row.prosthesisTypeCode,
selectionGroupId: row.selectionGroupId ?? '',
detail: {
id: row.treatmentDetailId,
treatmentType: row.treatmentType ?? 'prosthesis',
toothSelectionGroups: null,
},
})),
),
@@ -169,6 +172,49 @@ describe('generateLabCaseTasks', () => {
expect(stepCodes).toContain('printer_resin');
});
it('keeps separate selection groups with the same prosthesis type as separate task sets', async () => {
const pfmSteps = stepsFromSeed('pfm_crown');
const { tx, created } = buildMockTx({
toothProsthesisRows: [
{
treatmentDetailId: 'detail-1',
tooth: '14',
prosthesisTypeCode: 'pfm_crown',
selectionGroupId: 'connected-1',
},
{
treatmentDetailId: 'detail-1',
tooth: '15',
prosthesisTypeCode: 'pfm_crown',
selectionGroupId: 'connected-1',
},
{
treatmentDetailId: 'detail-1',
tooth: '21',
prosthesisTypeCode: 'pfm_crown',
selectionGroupId: 'single-21',
},
],
prosthesisTypes: [{ code: 'pfm_crown', steps: pfmSteps }],
});
const count = await generateLabCaseTasks(tx as never, 'lab-case-split', 'en');
expect(count).toBe(pfmSteps.length * 2);
const rows = created as Array<{
teeth: string[];
selectionGroupId: string;
prosthesisTypeCode: string;
}>;
const connected = rows.filter((r) => r.selectionGroupId === 'connected-1');
const single = rows.filter((r) => r.selectionGroupId === 'single-21');
expect(connected).toHaveLength(pfmSteps.length);
expect(single).toHaveLength(pfmSteps.length);
expect(connected.every((r) => JSON.stringify(r.teeth) === JSON.stringify(['14', '15']))).toBe(
true,
);
expect(single.every((r) => JSON.stringify(r.teeth) === JSON.stringify(['21']))).toBe(true);
});
it('skips generation when tasks already exist', async () => {
const { tx } = buildMockTx({
existingCount: 3,