Merge pull request 'Fixed upload documents counting for v4' (#212) from s.yahyaee/yara724-api:main into main

Reviewed-on: Yara724/api#212
This commit is contained in:
2026-07-25 09:53:07 +03:30

View File

@@ -419,8 +419,10 @@ export class ClaimRequestManagementService {
claimCase: any,
isCarBody: boolean,
assumeUploadedKey?: string,
skipMetalPlate?: boolean,
): boolean {
for (const k of this.v3PreCaptureDocumentKeys(isCarBody)) {
if (skipMetalPlate && OPTIONAL_CAPTURE_PHASE_DOC_KEYS_V4V5.includes(k as any)) continue;
const ok =
k === assumeUploadedKey
? true
@@ -442,9 +444,11 @@ export class ClaimRequestManagementService {
claimCase: any,
isCarBody: boolean,
assumeUploadedKey?: string,
skipMetalPlate?: boolean,
): number {
let n = 0;
for (const k of this.v3PreCaptureDocumentKeys(isCarBody)) {
if (skipMetalPlate && OPTIONAL_CAPTURE_PHASE_DOC_KEYS_V4V5.includes(k as any)) continue;
const ok =
k === assumeUploadedKey
? true
@@ -8620,6 +8624,7 @@ export class ClaimRequestManagementService {
claimCase,
isCarBodyUpload,
body.documentKey,
options?.skipMetalPlate,
);
allDocumentsUploaded = options?.v3InPersonFlow
@@ -8634,6 +8639,7 @@ export class ClaimRequestManagementService {
claimCase,
isCarBodyUpload,
body.documentKey,
options?.skipMetalPlate,
)
: this.countRemainingV2OwnerDocuments(
claimCase,
@@ -8729,10 +8735,11 @@ export class ClaimRequestManagementService {
)
: null;
const isCarBodyRecheck = blameForRecheck?.type === BlameRequestType.CAR_BODY;
const skipMetalPlateRecheck = !!(blameForRecheck as any)?.isMadeByFileMaker;
const allDoneNow =
afterWrite.status === ClaimCaseStatus.UPLOADING_REQUIRED_DOCUMENTS &&
afterWrite.workflow?.currentStep === ClaimWorkflowStep.UPLOAD_REQUIRED_DOCUMENTS &&
this.allV3PreCaptureDocumentsComplete(afterWrite, isCarBodyRecheck);
this.allV3PreCaptureDocumentsComplete(afterWrite, isCarBodyRecheck, undefined, skipMetalPlateRecheck);
if (allDoneNow) {
// Atomic conditional update: only succeeds when status is still