From 2c1cd93dd07980c803df93ad1cdaa9f32bcf5673 Mon Sep 17 00:00:00 2001 From: SepehrYahyaee <7heycallmegray@gmail.com> Date: Wed, 22 Jul 2026 15:46:33 +0330 Subject: [PATCH] Fixed sign --- .../request-management.service.ts | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/request-management/request-management.service.ts b/src/request-management/request-management.service.ts index 4cb1067..b304d0a 100644 --- a/src/request-management/request-management.service.ts +++ b/src/request-management/request-management.service.ts @@ -2113,10 +2113,6 @@ export class RequestManagementService { ? req.workflow.completedSteps : []; if (!completed.includes(stepKey)) completed.push(stepKey); - // Same as post–field-expert reply: guilt phase is satisfied without an expert; parties must still sign. - if (!completed.includes(WorkflowStep.WAITING_FOR_GUILT_DECISION)) { - completed.push(WorkflowStep.WAITING_FOR_GUILT_DECISION); - } req.workflow.completedSteps = completed; req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES; req.workflow.nextStep = WorkflowStep.WAITING_FOR_SIGNATURES; @@ -2200,9 +2196,6 @@ export class RequestManagementService { ? req.workflow.completedSteps : []; if (!completed.includes(stepKey)) completed.push(stepKey); - if (!completed.includes(WorkflowStep.WAITING_FOR_GUILT_DECISION)) { - completed.push(WorkflowStep.WAITING_FOR_GUILT_DECISION); - } req.workflow.completedSteps = completed; req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES; req.workflow.nextStep = WorkflowStep.WAITING_FOR_SIGNATURES; @@ -6836,34 +6829,24 @@ export class RequestManagementService { }, }; - // For IN_PERSON expert files that have not yet reached COMPLETED: after accident - // fields are filled, guilt is decided and we can go straight to signatures. - // When the file is already COMPLETED (both parties signed) we only save the - // supplemental fields without touching the workflow or status. - if ( - req.creationMethod === CreationMethod.IN_PERSON && - req.status !== CaseStatus.COMPLETED - ) { + // IN_PERSON V2 mirror: accident-fields is a post-sign supplemental step called + // only after COMPLETED (both parties have signed). Record WAITING_FOR_GUILT_DECISION + // in completedSteps here — it was intentionally omitted from description so the + // frontend does not route to this page before signatures are collected. + if (req.creationMethod === CreationMethod.IN_PERSON) { const completed = Array.isArray(req.workflow?.completedSteps) ? req.workflow.completedSteps : []; - const currentStep = req.workflow?.currentStep as WorkflowStep | undefined; - if (currentStep && !completed.includes(currentStep)) { - completed.push(currentStep); - } if (!completed.includes(WorkflowStep.WAITING_FOR_GUILT_DECISION)) { completed.push(WorkflowStep.WAITING_FOR_GUILT_DECISION); } if (req.workflow) { req.workflow.completedSteps = completed; - req.workflow.currentStep = WorkflowStep.WAITING_FOR_SIGNATURES; - req.workflow.nextStep = undefined; } - req.status = CaseStatus.WAITING_FOR_SIGNATURES; if (!Array.isArray(req.history)) req.history = []; req.history.push({ - type: "ACCIDENT_FIELDS_SAVED_ADVANCED_TO_SIGNATURES", + type: "ACCIDENT_FIELDS_SAVED", actor: { actorId: new Types.ObjectId(String(expert.sub)), actorName: @@ -6872,7 +6855,6 @@ export class RequestManagementService { }, metadata: { accidentWay: fields.accidentWay, - advancedTo: WorkflowStep.WAITING_FOR_SIGNATURES, }, } as any); }