Skip to content

Commit 8e96cb8

Browse files
committed
Hide Edit Scorecard for completed challenges
1 parent 7c8c791 commit 8e96cb8

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

src/apps/review/src/pages/active-review-assignements/ScorecardDetailsPage/ScorecardDetailsPage.tsx

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -336,22 +336,33 @@ export const ScorecardDetailsPage: FC<Props> = (props: Props) => {
336336
[myChallengeResources],
337337
)
338338

339-
const canEditScorecard = useMemo(
340-
() => Boolean(
339+
const canEditScorecard = useMemo(() => {
340+
const challengeStatus = (challengeInfo?.status ?? '')
341+
.toString()
342+
.trim()
343+
.toUpperCase()
344+
const isChallengeClosed = challengeStatus.includes('COMPLETED')
345+
|| challengeStatus.startsWith('CANCELLED')
346+
347+
if (isChallengeClosed) {
348+
return false
349+
}
350+
351+
return Boolean(
341352
reviewInfo?.committed
342353
&& (hasChallengeAdminRole
343354
|| hasTopcoderAdminRole
344355
|| hasChallengeManagerRole
345356
|| hasChallengeCopilotRole),
346-
),
347-
[
348-
hasChallengeAdminRole,
349-
hasChallengeCopilotRole,
350-
hasChallengeManagerRole,
351-
hasTopcoderAdminRole,
352-
reviewInfo?.committed,
353-
],
354-
)
357+
)
358+
}, [
359+
challengeInfo?.status,
360+
hasChallengeAdminRole,
361+
hasChallengeCopilotRole,
362+
hasChallengeManagerRole,
363+
hasTopcoderAdminRole,
364+
reviewInfo?.committed,
365+
])
355366

356367
// Redirect: if user is on a past-challenges route but the challenge is ACTIVE,
357368
// send them to the corresponding active-challenges route, preserving the rest of the path and query.

0 commit comments

Comments
 (0)