Fixed sign

This commit is contained in:
SepehrYahyaee
2026-07-22 15:46:33 +03:30
parent 64865b70f2
commit 2c1cd93dd0

View File

@@ -2113,10 +2113,6 @@ export class RequestManagementService {
? req.workflow.completedSteps
: [];
if (!completed.includes(stepKey)) completed.push(stepKey);
// Same as postfield-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);
}