1
0
forked from Yara724/api

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