40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import type { StatisticsInputCommonInfoBase } from "@/entities/statistics/model/statistics-interface";
|
|
|
|
import {
|
|
normalizeVerificationResultMap,
|
|
type VerificationResultLikeMap,
|
|
} from "./verification-result-display";
|
|
|
|
export function isVerificationFailedFromCommonInfo(
|
|
commonInfo: Pick<StatisticsInputCommonInfoBase, "isVerificationFailed"> | null | undefined,
|
|
): boolean {
|
|
return commonInfo?.isVerificationFailed === true;
|
|
}
|
|
|
|
export function patchVerificationFailedByTab(
|
|
prev: Map<string, boolean>,
|
|
tabKey: string,
|
|
commonInfo: Pick<StatisticsInputCommonInfoBase, "isVerificationFailed"> | null | undefined,
|
|
): Map<string, boolean> {
|
|
const next = new Map(prev);
|
|
next.set(tabKey, isVerificationFailedFromCommonInfo(commonInfo));
|
|
return next;
|
|
}
|
|
|
|
/** commonInfo.verificationResult → 탭별 총계 footer 검증 (우선보기 대상 아님) */
|
|
export function patchFooterVerificationByTab(
|
|
prev: Map<string, VerificationResultLikeMap | null>,
|
|
tabKey: string,
|
|
commonInfo:
|
|
| { verificationResult?: VerificationResultLikeMap | null }
|
|
| null
|
|
| undefined,
|
|
): Map<string, VerificationResultLikeMap | null> {
|
|
const next = new Map(prev);
|
|
next.set(
|
|
tabKey,
|
|
normalizeVerificationResultMap(commonInfo?.verificationResult) ?? null,
|
|
);
|
|
return next;
|
|
}
|