Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added exam mode #3106

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open

Conversation

kah-seng
Copy link

@kah-seng kah-seng commented Mar 4, 2025

Description

  • Added exam mode switch and exam mode preview to admin panel
  • Hides remote execution tab, Google Drive, GitHub, sessions, link sharing buttons when exam mode enabled
  • Prevent course switching/creation when exam mode enabled
  • Added dev tools detection/blocking
  • Added pausing of Source Academy and resume code functionality
  • Added tab switching detection
  • Added documentation tab for assessments

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Code quality improvements

How to test

Checklist

  • I have tested this code

@kah-seng kah-seng requested a review from RichDom2185 March 4, 2025 14:37
@kah-seng kah-seng self-assigned this Mar 4, 2025
Copy link
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor nits :), thanks!

@@ -15,6 +16,7 @@ type Props = {

const DropdownCourses: React.FC<Props> = ({ isOpen, onClose, courses, courseId }) => {
const navigate = useNavigate();
const enableExamMode = useTypedSelector(state => state.session.enableExamMode);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use useSession for simplicity:

Suggested change
const enableExamMode = useTypedSelector(state => state.session.enableExamMode);
const { enableExamMode } = useSession();

Comment on lines 37 to 41
const { courseId } = useSession();
const { courseId: routeCourseIdStr } = useParams<{ courseId?: string }>();
const routeCourseId = routeCourseIdStr != null ? parseInt(routeCourseIdStr, 10) : undefined;
const enableExamMode = useTypedSelector(state => state.session.enableExamMode);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useSession is a wrapper around useTypedSelector(state => state.session) among other things

Suggested change
const { courseId } = useSession();
const { courseId: routeCourseIdStr } = useParams<{ courseId?: string }>();
const routeCourseId = routeCourseIdStr != null ? parseInt(routeCourseIdStr, 10) : undefined;
const enableExamMode = useTypedSelector(state => state.session.enableExamMode);
const { courseId, enableExamMode } = useSession();
const { courseId: routeCourseIdStr } = useParams<{ courseId?: string }>();
const routeCourseId = routeCourseIdStr != null ? parseInt(routeCourseIdStr, 10) : undefined;

@coveralls
Copy link

coveralls commented Mar 6, 2025

Pull Request Test Coverage Report for Build 14279159954

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 46 of 414 (11.11%) changed or added relevant lines in 18 files are covered.
  • 187 unchanged lines in 6 files lost coverage.
  • Overall coverage decreased (-0.6%) to 30.541%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/commons/assessmentWorkspace/AssessmentWorkspace.tsx 2 3 66.67%
src/commons/documentation/SicpIndexPage.tsx 9 10 90.0%
src/commons/application/actions/SessionActions.ts 0 2 0.0%
src/commons/pauseAcademyOverlay/PauseAcademyOverlay.tsx 1 5 20.0%
src/pages/academy/Academy.tsx 0 4 0.0%
src/pages/academy/adminPanel/AdminPanel.tsx 0 4 0.0%
src/commons/sagas/RequestsSaga.ts 4 12 33.33%
src/commons/documentation/SicpToc.tsx 1 11 9.09%
src/pages/academy/adminPanel/subcomponents/CourseConfigPanel.tsx 0 10 0.0%
src/commons/sagas/BackendSaga.ts 1 14 7.14%
Files with Coverage Reduction New Missed Lines %
src/pages/academy/adminPanel/subcomponents/CourseConfigPanel.tsx 3 2.13%
src/commons/assessment/AssessmentTypes.ts 7 50.0%
src/pages/sicp/subcomponents/chatbot/ChatBox.tsx 24 7.04%
src/commons/sagas/BackendSaga.ts 38 42.86%
src/pages/academy/adminPanel/subcomponents/assessmentConfigPanel/AssessmentConfigPanel.tsx 52 0.0%
src/commons/assessmentWorkspace/AssessmentWorkspace.tsx 63 63.64%
Totals Coverage Status
Change from base Build 14174668514: -0.6%
Covered Lines: 4934
Relevant Lines: 15241

💛 - Coveralls

@RichDom2185 RichDom2185 self-requested a review March 16, 2025 07:44
@kah-seng kah-seng changed the title Added exam mode to admin panel and playground Added exam mode Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants