From fc0fdad054a104288e93d124125c5fb05ec97a3c Mon Sep 17 00:00:00 2001 From: Hentry Martin Date: Mon, 15 Dec 2025 14:40:39 +0100 Subject: [PATCH] fix: lint --- .../TabContentCheckpoint.tsx | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/apps/review/src/lib/components/ChallengeDetailsContent/TabContentCheckpoint.tsx b/src/apps/review/src/lib/components/ChallengeDetailsContent/TabContentCheckpoint.tsx index f30b53dda..2f1ed0b9f 100644 --- a/src/apps/review/src/lib/components/ChallengeDetailsContent/TabContentCheckpoint.tsx +++ b/src/apps/review/src/lib/components/ChallengeDetailsContent/TabContentCheckpoint.tsx @@ -1,7 +1,7 @@ /** * Content of checkpoint tab. */ -import { FC, useContext, useMemo } from 'react' +import { FC, useCallback, useContext, useMemo } from 'react' import { TableLoading } from '~/apps/admin/src/lib' import { IsRemovingType } from '~/apps/admin/src/lib/models' @@ -75,6 +75,32 @@ export const TabContentCheckpoint: FC = (props: Props) => { [props.checkpointReview, myMemberIds, props.checkpointReviewMinimumPassingScore], ) + const checkpointScreeningOutcome = useMemo( + () => { + const passingSubmissionIds = new Set() + const failingSubmissionIds = new Set() + + props.checkpoint.forEach(entry => { + if (!entry?.submissionId) { + return + } + + const normalizedResult = (entry.result || '').toUpperCase() + if (normalizedResult === 'PASS') { + passingSubmissionIds.add(`${entry.submissionId}`) + } else if (normalizedResult === 'NO PASS') { + failingSubmissionIds.add(`${entry.submissionId}`) + } + }) + + return { + failingSubmissionIds, + passingSubmissionIds, + } + }, + [props.checkpoint], + ) + const filteredCheckpoint = useMemo( () => { const baseRows = props.checkpoint ?? [] @@ -107,9 +133,15 @@ export const TabContentCheckpoint: FC = (props: Props) => { ], ) + const filterCheckpointReviewByScreeningResult = useCallback( + (screening: Screening[]) => screening + .filter(row => checkpointScreeningOutcome.passingSubmissionIds.has(`${row.submissionId}`)), + [checkpointScreeningOutcome], + ) + const filteredCheckpointReview = useMemo( () => { - const baseRows = props.checkpointReview ?? [] + const baseRows = filterCheckpointReviewByScreeningResult(props.checkpointReview ?? []) if (isPrivilegedRole || (isChallengeCompleted && hasPassedCheckpointReviewThreshold)) { return baseRows @@ -135,6 +167,7 @@ export const TabContentCheckpoint: FC = (props: Props) => { hasPassedCheckpointReviewThreshold, checkpointReviewerResourceIds, myMemberIds, + checkpointScreeningOutcome, ], )