YARA-1202 FIX removed all damaged parts

This commit is contained in:
SepehrYahyaee
2026-08-03 14:29:13 +03:30
parent 70d05a7624
commit 65870c8d66
2 changed files with 31 additions and 23 deletions

View File

@@ -10615,8 +10615,8 @@ export class RequestManagementService {
const newRejectionCount = currentRejections + 1;
const actorName = `${fileMaker.firstName || ""} ${fileMaker.lastName || ""}`.trim();
// Steps that belong to the damage-assessment cycle being discarded.
// They are pulled from completedSteps so the FileReviewer can re-run them.
// Steps that belong to the re-run assessment cycle.
// Pulled from completedSteps so workflow ordering guards pass on re-run.
const assessmentSteps = [
ClaimWorkflowStep.SELECT_OUTER_PARTS,
ClaimWorkflowStep.SELECT_OTHER_PARTS,
@@ -10630,21 +10630,18 @@ export class RequestManagementService {
claimStatus: ClaimStatus.NEEDS_REVISION,
fileMakerRejectionCount: newRejectionCount,
fileMakerRejectionReason: reason ?? null,
// Reset to UPLOAD_REQUIRED_DOCUMENTS so advanceV3ClaimToOuterPartsIfReady
// can advance the claim to SELECT_OUTER_PARTS when the FileReviewer calls
// select-outer-parts again.
"workflow.currentStep": ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS,
"workflow.nextStep": ClaimWorkflowStep.SELECT_OUTER_PARTS,
// Land directly at SELECT_OUTER_PARTS: the FileReviewer sees the
// existing parts pre-populated and can adjust or confirm them.
"workflow.currentStep": ClaimWorkflowStep.SELECT_OUTER_PARTS,
"workflow.nextStep": ClaimWorkflowStep.SELECT_OTHER_PARTS,
"workflow.locked": false,
// Flag consumed by selectOuterPartsV2 / selectOtherPartsV2 to allow
// overwriting previously submitted data instead of throwing ConflictException.
"fileMakerRejectedPendingReview": true,
},
// Clear all stale data from the rejected assessment cycle:
// - workflow lock fields left over from the completed review cycle
// - evaluation sub-documents (reply, resend, approvals)
// - damage selections: selectedParts, otherParts
// - media captures: damagedPart photos, walk-around video
// (the FileReviewer must re-select parts and re-photograph everything)
// - assignedForReviewBy intentionally kept so the same reviewer
// is still scoped to this file on re-lock
// Clear stale lock/evaluation fields and media that must be re-captured.
// Part selections (damage.selectedParts, damage.otherParts) are intentionally
// preserved as a pre-populated starting point for the FileReviewer to adjust.
$unset: {
"workflow.lockedAt": "",
"workflow.expiredAt": "",
@@ -10654,14 +10651,13 @@ export class RequestManagementService {
"evaluation.damageExpertResend": "",
"evaluation.ownerInsurerApproval": "",
"evaluation.ownerPricedPartsApproval": "",
"damage.selectedParts": "",
"damage.otherParts": "",
// Photos and walk-around video must be re-taken for the new part set.
"media.damagedParts": "",
"media.captures": "",
"media.videoCaptureId": "",
},
// Remove assessment-cycle steps from completedSteps so none of the
// "already completed" guards fire when the FileReviewer re-runs them.
// Remove assessment-cycle steps from completedSteps so workflow ordering
// guards pass when the FileReviewer re-runs each step.
$pull: {
"workflow.completedSteps": { $in: assessmentSteps },
},