forked from Yara724/api
daghi problem fixed , 2 apis for reporting counts added
This commit is contained in:
49
src/helpers/expert-panel-status-report.ts
Normal file
49
src/helpers/expert-panel-status-report.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { CaseStatus } from "src/Types&Enums/blame-request-management/caseStatus.enum";
|
||||
import { ClaimCaseStatus } from "src/Types&Enums/claim-request-management/claim-case-status.enum";
|
||||
|
||||
/** Blame: early workflow before expert queue / resend / signatures / terminals. */
|
||||
const BLAME_IN_PROGRESS_STATUSES = new Set<string>([
|
||||
CaseStatus.OPEN,
|
||||
CaseStatus.WAITING_FOR_SECOND_PARTY,
|
||||
]);
|
||||
|
||||
/**
|
||||
* Claim: user flow before submission is complete (analog to `ClaimWorkflowStep.USER_SUBMISSION_COMPLETE`).
|
||||
*/
|
||||
const CLAIM_IN_PROGRESS_STATUSES = new Set<string>([
|
||||
ClaimCaseStatus.CREATED,
|
||||
ClaimCaseStatus.SELECTING_OUTER_PARTS,
|
||||
ClaimCaseStatus.SELECTING_OTHER_PARTS,
|
||||
ClaimCaseStatus.UPLOADING_REQUIRED_DOCUMENTS,
|
||||
ClaimCaseStatus.CAPTURING_PART_DAMAGES,
|
||||
]);
|
||||
|
||||
export function blameCaseStatusToReportBucket(status: string): string {
|
||||
if (BLAME_IN_PROGRESS_STATUSES.has(status)) return "IN_PROGRESS";
|
||||
return status;
|
||||
}
|
||||
|
||||
export function claimCaseStatusToReportBucket(status: string): string {
|
||||
if (CLAIM_IN_PROGRESS_STATUSES.has(status)) return "IN_PROGRESS";
|
||||
return status;
|
||||
}
|
||||
|
||||
/** Keys returned for blame V2 expert report (IN_PROGRESS + each native post-early status). */
|
||||
export function initialBlameExpertReportBuckets(): Record<string, number> {
|
||||
const out: Record<string, number> = { all: 0, IN_PROGRESS: 0 };
|
||||
for (const s of Object.values(CaseStatus)) {
|
||||
if (BLAME_IN_PROGRESS_STATUSES.has(s)) continue;
|
||||
out[s] = 0;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Keys returned for claim V2 expert report. */
|
||||
export function initialClaimExpertReportBuckets(): Record<string, number> {
|
||||
const out: Record<string, number> = { all: 0, IN_PROGRESS: 0 };
|
||||
for (const s of Object.values(ClaimCaseStatus)) {
|
||||
if (CLAIM_IN_PROGRESS_STATUSES.has(s)) continue;
|
||||
out[s] = 0;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
Reference in New Issue
Block a user