diff --git a/src/apps/review/src/lib/utils/challenge.spec.ts b/src/apps/review/src/lib/utils/challenge.spec.ts index 8b4366a94..64ee4197d 100644 --- a/src/apps/review/src/lib/utils/challenge.spec.ts +++ b/src/apps/review/src/lib/utils/challenge.spec.ts @@ -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: [ diff --git a/src/apps/review/src/lib/utils/challenge.ts b/src/apps/review/src/lib/utils/challenge.ts index 44aa240e8..a4e45352f 100644 --- a/src/apps/review/src/lib/utils/challenge.ts +++ b/src/apps/review/src/lib/utils/challenge.ts @@ -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(