Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ export const ChallengeDetailsContent: FC<Props> = (props: Props) => {
selectedTab={props.selectedTab}
reviews={reviewTabReviews}
submitterReviews={reviewTabSubmitterReviews}
screeningOutcome={screeningOutcome}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The screeningOutcome variable is being passed to the TabContentReview component. Ensure that this component is designed to handle the new screeningOutcome prop correctly, especially if it wasn't previously expecting this data. This could impact the component's behavior if not handled properly.

reviewMinimumPassingScore={props.reviewMinimumPassingScore}
isLoadingReview={props.isLoadingSubmission}
isDownloading={isDownloadingSubmission}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ import { hasSubmitterPassedThreshold } from '../../utils/reviewScoring'
interface Props {
aiReviewers?: { aiWorkflowId: string }[]
selectedTab: string
screeningOutcome: {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 maintainability]
Consider using ReadonlySet<string> for failingSubmissionIds and passingSubmissionIds to ensure immutability and prevent accidental modifications.

failingSubmissionIds: Set<string>;
passingSubmissionIds: Set<string>;
}
reviews: SubmissionInfo[]
submitterReviews: SubmissionInfo[]
reviewMinimumPassingScore?: number | null
Expand Down Expand Up @@ -636,6 +640,7 @@ export const TabContentReview: FC<Props> = (props: Props) => {
},
[resolvedReviewsWithSubmitter],
)

const filteredSubmitterReviews = useMemo(
() => {
if (!resolvedSubmitterReviews.length) {
Expand Down Expand Up @@ -729,6 +734,7 @@ export const TabContentReview: FC<Props> = (props: Props) => {
<TableReview
aiReviewers={props.aiReviewers}
datas={reviewRows}
screeningOutcome={props.screeningOutcome}
isDownloading={props.isDownloading}
downloadSubmission={props.downloadSubmission}
mappingReviewAppeal={props.mappingReviewAppeal}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const ReviewManagerComment: FC<ReviewManagerCommentProps> = props => {
<div className={styles.content}>
<MarkdownReview value={comment} />
</div>
{isManagerEdit && (
{isManagerEdit && canAddManagerComment && (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The addition of canAddManagerComment to the condition ensures that the edit button is only shown when both isManagerEdit and canAddManagerComment are true. Verify that canAddManagerComment is correctly set in all contexts where this component is used, as any oversight could lead to unexpected behavior where the edit button is not displayed when it should be.

<button
type='button'
onClick={handleShowCommentForm}
Expand Down
19 changes: 17 additions & 2 deletions src/apps/review/src/lib/components/TableReview/TableReview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export interface TableReviewProps {
aiReviewers?: { aiWorkflowId: string }[]
className?: string
datas: SubmissionInfo[]
screeningOutcome: {
failingSubmissionIds: Set<string>;
passingSubmissionIds: Set<string>;
}
isDownloading: IsRemovingType
downloadSubmission: (submissionId: string) => void
mappingReviewAppeal: MappingReviewAppeal
Expand Down Expand Up @@ -230,9 +234,20 @@ export const TableReview: FC<TableReviewProps> = (props: TableReviewProps) => {
[myReviewerResourceIds],
)

const filterScreeningPassedReviews = useCallback(
(submissions: SubmissionInfo[]): SubmissionInfo[] => submissions.filter(
submission => props.screeningOutcome.passingSubmissionIds.has(submission.id ?? ''),
),
[props.screeningOutcome.passingSubmissionIds],
)

const submissionsForAggregation = useMemo<SubmissionInfo[]>(
() => (restrictToLatest ? latestSubmissions : reviewPhaseDatas),
[latestSubmissions, restrictToLatest, reviewPhaseDatas],
() => (
restrictToLatest
? filterScreeningPassedReviews(latestSubmissions)
: filterScreeningPassedReviews(reviewPhaseDatas)
),
[latestSubmissions, restrictToLatest, reviewPhaseDatas, filterScreeningPassedReviews],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ performance]
The dependency array for useMemo includes filterScreeningPassedReviews, which is a function. Functions are recreated on every render, causing this useMemo to recalculate every time. Consider using useCallback for filterScreeningPassedReviews to ensure stable references.

)

const aggregatedSubmissionRows = useMemo<AggregatedSubmissionReviews[]>(() => (
Expand Down
Loading