Skip to content

Commit e415676

Browse files
committed
Show leaderboards only after assessment has been published
1 parent 40048b4 commit e415676

File tree

1 file changed

+31
-26
lines changed

1 file changed

+31
-26
lines changed

src/commons/assessmentWorkspace/AssessmentWorkspace.tsx

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
464464
const isTeamAssessment =
465465
assessmentOverview !== undefined ? assessmentOverview.maxTeamSize > 1 : false;
466466
const isContestVoting = question?.type === QuestionTypes.voting;
467+
const isPublished = assessmentOverview?.isPublished;
467468
const handleContestEntryClick = (_submissionId: number, answer: string) => {
468469
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable Folder mode.
469470
handleEditorValueChange(0, answer);
@@ -538,34 +539,38 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
538539
/>
539540
),
540541
id: SideContentType.contestVoting
541-
},
542-
{
543-
label: 'Score Leaderboard',
544-
iconName: IconNames.CROWN,
545-
body: (
546-
<SideContentContestLeaderboard
547-
handleContestEntryClick={handleContestEntryClick}
548-
orderedContestEntries={(question as IContestVotingQuestion)?.scoreLeaderboard ?? []}
549-
leaderboardType={SideContentType.scoreLeaderboard}
550-
/>
551-
),
552-
id: SideContentType.scoreLeaderboard
553-
},
554-
{
555-
label: 'Popular Vote Leaderboard',
556-
iconName: IconNames.PEOPLE,
557-
body: (
558-
<SideContentContestLeaderboard
559-
handleContestEntryClick={handleContestEntryClick}
560-
orderedContestEntries={
561-
(question as IContestVotingQuestion)?.popularVoteLeaderboard ?? []
562-
}
563-
leaderboardType={SideContentType.popularVoteLeaderboard}
564-
/>
565-
),
566-
id: SideContentType.popularVoteLeaderboard
567542
}
568543
);
544+
if (isPublished) {
545+
tabs.push(
546+
{
547+
label: 'Score Leaderboard',
548+
iconName: IconNames.CROWN,
549+
body: (
550+
<SideContentContestLeaderboard
551+
handleContestEntryClick={handleContestEntryClick}
552+
orderedContestEntries={(question as IContestVotingQuestion)?.scoreLeaderboard ?? []}
553+
leaderboardType={SideContentType.scoreLeaderboard}
554+
/>
555+
),
556+
id: SideContentType.scoreLeaderboard
557+
},
558+
{
559+
label: 'Popular Vote Leaderboard',
560+
iconName: IconNames.PEOPLE,
561+
body: (
562+
<SideContentContestLeaderboard
563+
handleContestEntryClick={handleContestEntryClick}
564+
orderedContestEntries={
565+
(question as IContestVotingQuestion)?.popularVoteLeaderboard ?? []
566+
}
567+
leaderboardType={SideContentType.popularVoteLeaderboard}
568+
/>
569+
),
570+
id: SideContentType.popularVoteLeaderboard
571+
}
572+
);
573+
}
569574
} else {
570575
tabs.push(
571576
{

0 commit comments

Comments
 (0)