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
19 changes: 19 additions & 0 deletions src/apps/review/src/lib/hooks/useFetchScreeningReview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,25 @@ export function useFetchScreeningReview(): useFetchScreeningReviewProps {
reviewEntries: reviewsToRender,
})

const hasCheckpointReview = rowsForSubmission.some(row => Boolean(row.reviewId))

Choose a reason for hiding this comment

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

[⚠️ correctness]
The variable hasCheckpointReview is determined by checking if any row in rowsForSubmission has a reviewId. Ensure that rowsForSubmission is correctly populated with the expected data before this check, as any issues in data population could lead to incorrect logic execution.

const submissionStatus = (item.status ?? '')
.toString()
.trim()
.toUpperCase()
const failedCheckpointScreening = submissionStatus === 'FAILED_CHECKPOINT_SCREENING'

Choose a reason for hiding this comment

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

[💡 maintainability]
The logic for determining failedCheckpointScreening relies on the status being exactly 'FAILED_CHECKPOINT_SCREENING'. Consider using a constant or enum for status values to avoid potential typos and improve maintainability.


if (failedCheckpointScreening && !hasCheckpointReview) {

Choose a reason for hiding this comment

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

[⚠️ design]
The condition failedCheckpointScreening && !hasCheckpointReview results in an early return of rows. Ensure that this logic aligns with the intended behavior, as it skips adding rowsForSubmission to rows, which might be necessary for other parts of the application.

if (debugCheckpointPhases) {
debugLog('checkpointReview.skipSubmission', {
reason: 'failedCheckpointScreeningWithoutReview',
submissionId: item.id,
submissionStatus,
})
}

return rows
}

rows.push(...rowsForSubmission)

return rows
Expand Down
5 changes: 4 additions & 1 deletion src/apps/review/src/lib/hooks/useRole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ const useRole = (): useRoleProps => {
return ''
}

const normalizedRoles = myRoles.map(role => role.toLowerCase())
const normalizedRoles = [
...myRoles.map(role => role.toLowerCase()),
...(isTopcoderAdmin ? ['admin'] : []),

Choose a reason for hiding this comment

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

[⚠️ correctness]
The addition of admin to normalizedRoles when isTopcoderAdmin is true could potentially lead to a mismatch in role priority if the casing of roles is inconsistent elsewhere. Ensure that all role comparisons are case-insensitive to avoid unexpected behavior.

]
const rolePriority: ChallengeRole[] = [
'Admin',
'Manager',
Expand Down
Loading