forked from Yara724/api
Merge pull request 'Fixed sign' (#207) from s.yahyaee/yara724-api:main into main
Reviewed-on: Yara724/api#207
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user