Skip to content

Commit 7c8c791

Browse files
committed
Better display of assigned reviewers PM-2441
1 parent b4736a9 commit 7c8c791

File tree

1 file changed

+4
-85
lines changed

1 file changed

+4
-85
lines changed

src/apps/review/src/lib/hooks/useFetchScreeningReview.ts

Lines changed: 4 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import { fetchChallengeReviews } from '../services'
2929
import { useFetchAppealQueue, useFetchAppealQueueProps } from './useFetchAppealQueue'
3030
import { useFetchChallengeSubmissions, useFetchChallengeSubmissionsProps } from './useFetchChallengeSubmissions'
3131
import { useRole, useRoleProps } from './useRole'
32-
import { useSubmissionDownloadAccess } from './useSubmissionDownloadAccess'
33-
import type { UseSubmissionDownloadAccessResult } from './useSubmissionDownloadAccess'
3432

3533
/**
3634
* DEBUG_CHECKPOINT_PHASES instrumentation coordinates verbose logging for checkpoint screening analysis.
@@ -899,61 +897,9 @@ export function useFetchScreeningReview(): useFetchScreeningReviewProps {
899897
isLoading,
900898
}: useFetchChallengeSubmissionsProps = useFetchChallengeSubmissions(challengeId)
901899

902-
const {
903-
currentMemberId,
904-
shouldRestrictSubmitterToOwnSubmission,
905-
}: UseSubmissionDownloadAccessResult = useSubmissionDownloadAccess()
906-
907-
const submitterCanViewAllSubmissions = useMemo(() => {
908-
if (actionChallengeRole !== SUBMITTER) {
909-
return false
910-
}
911-
912-
const rawTypeName = (challengeInfo?.type?.name || '').toString()
913-
const rawTrackName = (challengeInfo?.track?.name || '').toString()
914-
const typeName = rawTypeName.toLowerCase()
915-
const trackName = rawTrackName.toLowerCase()
916-
917-
return typeName === 'first2finish'
918-
|| trackName === 'first2finish'
919-
|| typeName === 'topgear task'
920-
|| trackName === 'topgear task'
921-
}, [actionChallengeRole, challengeInfo?.track?.name, challengeInfo?.type?.name])
922-
923-
const shouldFilterVisibleSubmissionsToOwn = useMemo(
924-
() => shouldRestrictSubmitterToOwnSubmission && !submitterCanViewAllSubmissions,
925-
[shouldRestrictSubmitterToOwnSubmission, submitterCanViewAllSubmissions],
926-
)
927-
928900
const visibleChallengeSubmissions = useMemo<BackendSubmission[]>(
929-
() => {
930-
if (!shouldFilterVisibleSubmissionsToOwn) {
931-
return allChallengeSubmissions
932-
}
933-
934-
if (!currentMemberId) {
935-
return []
936-
}
937-
938-
return allChallengeSubmissions.filter(
939-
submission => submission.memberId === currentMemberId,
940-
)
941-
},
942-
[
943-
allChallengeSubmissions,
944-
currentMemberId,
945-
shouldFilterVisibleSubmissionsToOwn,
946-
],
947-
)
948-
949-
const visibleSubmissionIds = useMemo(
950-
() => new Set(visibleChallengeSubmissions.map(submission => submission.id)),
951-
[visibleChallengeSubmissions],
952-
)
953-
954-
const visibleLegacySubmissionIds = useMemo(
955-
() => new Set(visibleChallengeSubmissions.map(submission => submission.legacySubmissionId)),
956-
[visibleChallengeSubmissions],
901+
() => allChallengeSubmissions,
902+
[allChallengeSubmissions],
957903
)
958904

959905
const visibleSubmissionsById = useMemo(
@@ -1109,35 +1055,8 @@ export function useFetchScreeningReview(): useFetchScreeningReviewProps {
11091055
)
11101056

11111057
const challengeReviews = useMemo(
1112-
() => {
1113-
if (!challengeReviewsData) {
1114-
return challengeReviewsData
1115-
}
1116-
1117-
if (!shouldFilterVisibleSubmissionsToOwn) {
1118-
return challengeReviewsData
1119-
}
1120-
1121-
const filtered = challengeReviewsData.filter(reviewItem => (
1122-
visibleSubmissionIds.has(reviewItem.submissionId)
1123-
|| visibleLegacySubmissionIds.has(reviewItem.legacySubmissionId)
1124-
))
1125-
1126-
if (debugCheckpointPhases && filtered.length !== challengeReviewsData.length) {
1127-
console.debug('[useFetchScreeningReview] submitter review filter applied', {
1128-
filteredOut: challengeReviewsData.length - filtered.length,
1129-
})
1130-
}
1131-
1132-
return filtered
1133-
},
1134-
[
1135-
challengeReviewsData,
1136-
shouldFilterVisibleSubmissionsToOwn,
1137-
visibleSubmissionIds,
1138-
visibleLegacySubmissionIds,
1139-
debugCheckpointPhases,
1140-
],
1058+
() => challengeReviewsData,
1059+
[challengeReviewsData],
11411060
)
11421061

11431062
// Resolve scorecard ids and phase ids for Screening / Checkpoint phases

0 commit comments

Comments
 (0)