From c4668c4f9ba5fbd5cf775845865d5d8119c1af68 Mon Sep 17 00:00:00 2001 From: Alex Lewin Date: Thu, 24 Oct 2024 14:58:59 +0100 Subject: [PATCH 1/3] Show test visibility in My Tests Show the 'visible to students'/'hidden from teachers' labels from Set Tests on My Tests > Practice Tests. --- src/app/components/pages/quizzes/MyQuizzes.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/components/pages/quizzes/MyQuizzes.tsx b/src/app/components/pages/quizzes/MyQuizzes.tsx index a7745a65a8..5f9780c453 100644 --- a/src/app/components/pages/quizzes/MyQuizzes.tsx +++ b/src/app/components/pages/quizzes/MyQuizzes.tsx @@ -14,6 +14,7 @@ import {AppQuizAssignment} from "../../../../IsaacAppTypes"; import { extractTeacherName, isAttempt, + isEventLeaderOrStaff, isFound, isTutorOrAbove, partitionCompleteAndIncompleteQuizzes, @@ -150,6 +151,11 @@ const MyQuizzesPageComponent = ({user}: MyQuizzesPageProps) => { } }; + const roleVisibilitySummary = (quiz: QuizSummaryDTO) => <> + {isEventLeaderOrStaff(user) && quiz.hiddenFromRoles && quiz.hiddenFromRoles?.includes("TEACHER") &&
hidden from teachers
} + {isTutorOrAbove(user) && ((quiz.hiddenFromRoles && !quiz.hiddenFromRoles?.includes("STUDENT")) || quiz.visibleToStudents) &&
visible to students
} + ; + const tabAnchors = ["#in-progress", "#completed", "#practice"]; const anchorMap = tabAnchors.reduce((acc, anchor, index) => @@ -208,8 +214,11 @@ const MyQuizzesPageComponent = ({user}: MyQuizzesPageProps) => { {quizzes.filter((quiz) => showQuiz(quiz) && quiz.title?.toLowerCase().includes(filterText.toLowerCase())).map(quiz =>
- {quiz.title} - {quiz.summary &&
{quiz.summary}
} +
+ {quiz.title} + {roleVisibilitySummary(quiz)} + {quiz.summary &&
{quiz.summary}
} +
{isTutorOrAbove(user) &&
From ac5a6c112ccd535e26d1f578a19dc279342bfeb5 Mon Sep 17 00:00:00 2001 From: Alex Lewin Date: Thu, 24 Oct 2024 16:15:44 +0100 Subject: [PATCH 2/3] Copy comment from SetQuizzes Co-authored-by: Sol <94075844+sjd210@users.noreply.github.com> --- src/app/components/pages/quizzes/MyQuizzes.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/components/pages/quizzes/MyQuizzes.tsx b/src/app/components/pages/quizzes/MyQuizzes.tsx index 5f9780c453..9c1ca8b162 100644 --- a/src/app/components/pages/quizzes/MyQuizzes.tsx +++ b/src/app/components/pages/quizzes/MyQuizzes.tsx @@ -151,6 +151,8 @@ const MyQuizzesPageComponent = ({user}: MyQuizzesPageProps) => { } }; + // If the user is event admin or above, and the quiz is hidden from teachers, then show that + // Otherwise, show if the quiz is visible to students const roleVisibilitySummary = (quiz: QuizSummaryDTO) => <> {isEventLeaderOrStaff(user) && quiz.hiddenFromRoles && quiz.hiddenFromRoles?.includes("TEACHER") &&
hidden from teachers
} {isTutorOrAbove(user) && ((quiz.hiddenFromRoles && !quiz.hiddenFromRoles?.includes("STUDENT")) || quiz.visibleToStudents) &&
visible to students
} From 6b7015964e14d77f26869eaa663ae98b424b27b3 Mon Sep 17 00:00:00 2001 From: Alex Lewin Date: Thu, 24 Oct 2024 16:17:48 +0100 Subject: [PATCH 3/3] Clarify comment --- src/app/components/pages/quizzes/MyQuizzes.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/pages/quizzes/MyQuizzes.tsx b/src/app/components/pages/quizzes/MyQuizzes.tsx index 9c1ca8b162..4edfe730a4 100644 --- a/src/app/components/pages/quizzes/MyQuizzes.tsx +++ b/src/app/components/pages/quizzes/MyQuizzes.tsx @@ -152,7 +152,7 @@ const MyQuizzesPageComponent = ({user}: MyQuizzesPageProps) => { }; // If the user is event admin or above, and the quiz is hidden from teachers, then show that - // Otherwise, show if the quiz is visible to students + // If the user is teacher or above, show if the quiz is visible to students const roleVisibilitySummary = (quiz: QuizSummaryDTO) => <> {isEventLeaderOrStaff(user) && quiz.hiddenFromRoles && quiz.hiddenFromRoles?.includes("TEACHER") &&
hidden from teachers
} {isTutorOrAbove(user) && ((quiz.hiddenFromRoles && !quiz.hiddenFromRoles?.includes("STUDENT")) || quiz.visibleToStudents) &&
visible to students
}