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
23 changes: 23 additions & 0 deletions src/apps/review/src/lib/utils/challenge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,29 @@ describe('challenge phase tab helpers', () => {
.toBe(false)
})

it('force-shows winners for past challenges with winners even when a phase remains open', () => {
expect(shouldAllowWinnersTabForPastChallenge({
phases: [
createBackendPhase('iterative-1', 'Iterative Review', '2026-04-20T00:00:00Z', {
isOpen: true,
}),
],
status: 'COMPLETED',
}))
.toBe(false)

expect(shouldForceWinnersTabForPastChallenge({
phases: [
createBackendPhase('iterative-1', 'Iterative Review', '2026-04-20T00:00:00Z', {
isOpen: true,
}),
],
status: 'COMPLETED',
winners: [{ handle: 'winner-one', placement: 1, userId: 1 }],
}))
.toBe(true)
})

it('keeps winners hidden when a follow-up approval review is still pending', () => {
const challengeInfo = {
phases: [
Expand Down
6 changes: 5 additions & 1 deletion src/apps/review/src/lib/utils/challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,11 +743,15 @@ export function shouldForceWinnersTabForPastChallenge(
challengeInfo?: WinnersTabFallbackChallengeInfo,
approvalReviews?: ApprovalReviewStatusLike[] | null,
): boolean {
if (!isPastChallengeStatus(challengeInfo?.status)) {
return false
}

if (!(challengeInfo?.winners?.length)) {
return false
}

return shouldAllowWinnersTabForPastChallenge(challengeInfo, approvalReviews)
return !hasPendingApprovalReview(approvalReviews)
}

export function isReviewPhaseCurrentlyOpen(
Expand Down
Loading