backend icon indicating copy to clipboard operation
backend copied to clipboard

Added Exam mode

Open iZUMi-kyouka opened this issue 10 months ago • 3 comments

Description

  • Added exam mode functionality in the backend by adding enable_exam_mode and is_official_course in the courses table.
  • Added get_exam_mode_course() function in lib/cadet/accounts/course_registrations.ex
  • Modified lib/cadet_web/controllers/user_controller.ex logic in serving the last_viewed_course to always serve the official institution course under exam_mode if any of the user's official course is currently under exam mode. Performed the same modification for get_latest_viewed() function in the same file.
  • Added the required migrations file to alter the database
  • Added the 2 additional fields in the model and wherever necessary

01/04/25

  • Added resume_code to courses table
  • Added isPaused to users table
  • Added some tests for enable_exam_mode, is_official_course, and resume_code for the changesets

09/04/25

  • Added user_browser_focus_log table in the DB
  • Added the required endpoint to log when a user's browser loses focus and regains focus when under exam mode

Note: this may require change to the DB diagram in README.md

Type of Change

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

Checklist

  • [x] I have tested this code
  • [ ] I have updated the documentation

iZUMi-kyouka avatar Mar 04 '25 15:03 iZUMi-kyouka

Coverage Status

coverage: 88.77% (-0.9%) from 89.636% when pulling f1ed0bceacf68f7b33233648b8f509d708e001a1 on iZUMi-kyouka:exam_mode into 40cd12aaa61ad4fb71224dec56b2505f14f46211 on source-academy:master.

coveralls avatar Mar 31 '25 09:03 coveralls

One more thing which just came to mind. Correct me if I am wrong, your current implementation places all users with a course which has exam mode enabled have their SA placed on some sort of "lock down". Wouldn't this limit the use for admins/staff during the time in which the course is on lock down?

GabrielCWT avatar Apr 03 '25 05:04 GabrielCWT

One more thing which just came to mind. Correct me if I am wrong, your current implementation places all users with a course which has exam mode enabled have their SA placed on some sort of "lock down". Wouldn't this limit the use for admins/staff during the time in which the course is on lock down?

@GabrielCWT Yes this is correct as of now. I will work on excluding them, so that staffs and admins work as usual, thanks!

iZUMi-kyouka avatar Apr 03 '25 10:04 iZUMi-kyouka