Skip to content

Added Exam mode #1236

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

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

Conversation

iZUMi-kyouka
Copy link

@iZUMi-kyouka iZUMi-kyouka commented Mar 4, 2025

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)
  • 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

Checklist

  • I have tested this code
  • I have updated the documentation

@iZUMi-kyouka iZUMi-kyouka requested a review from RichDom2185 March 4, 2025 15:17
@iZUMi-kyouka iZUMi-kyouka self-assigned this Mar 4, 2025
@iZUMi-kyouka iZUMi-kyouka marked this pull request as ready for review March 4, 2025 15:29
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.

We don't need isOfficialCourse anymore, right?

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.

Please fix the failing tests, thanks!

@coveralls
Copy link

coveralls commented Mar 31, 2025

Coverage Status

coverage: 92.453% (-1.2%) from 93.607%
when pulling 1c3d787 on iZUMi-kyouka:exam_mode
into 5c7b5cf on source-academy:master.

@@ -21,6 +21,7 @@ defmodule Cadet.Accounts.User do
field(:provider, :string)
field(:super_admin, :boolean)
field(:email, :string)
field(:is_paused, :boolean)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why this is linked to the user and not their course_registration? Isn't exam mode related to their course.

Copy link
Author

Choose a reason for hiding this comment

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

Initially I thought linking this to the user would allow for the enforcing of the pause beyond the course so that if a user is paused due to opening other app / using dev tool (which is our plan), the user will have to settle the problem with the course admin / coordinator. But, now that you pointed out, maybe this should not affect the user through all their courses. Should I move this course_registration?

Copy link
Contributor

Choose a reason for hiding this comment

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

@RichDom2185 thoughts?

@GabrielCWT
Copy link
Contributor

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?

@iZUMi-kyouka
Copy link
Author

iZUMi-kyouka commented Apr 3, 2025

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!

…o separate private functions for readability.
…_controller; fixed a typing error in send_resp
…es returned; improved readibility for pause_user"

This reverts commit 31bbf5a.
…changeset, and applied it in the focus logging controlelr
…ation on creation of new course; rejects all course config update with empty resume code regardless of exam mode state
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