-
Notifications
You must be signed in to change notification settings - Fork 53
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
iZUMi-kyouka
wants to merge
45
commits into
source-academy:master
Choose a base branch
from
iZUMi-kyouka:exam_mode
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Added Exam mode #1236
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
fc72d29
added enable_exam_mode field to all tests, models, and controllers
iZUMi-kyouka 2fc38ca
force student whose courses has exam mode to only access the particul…
iZUMi-kyouka 9953b9c
fixed failure to switch course even when no exam mode is enabled for …
iZUMi-kyouka f450e85
fixed unintended changes to previous migration; added migration file …
iZUMi-kyouka 0bb9857
added is_official_course field to models; added logic to prevent stud…
iZUMi-kyouka d7ad8b3
removed unnecessary changes in course_registrations.ex
iZUMi-kyouka f216d1b
removed unnecessary changes from user_controller.ex
iZUMi-kyouka 48fff28
sync fork
iZUMi-kyouka b5f2722
Merge branch 'master' into exam_mode
RichDom2185 bc4c48c
added resume code functionality
iZUMi-kyouka 46c2ff0
Merge remote-tracking branch 'refs/remotes/origin/exam_mode' into exa…
iZUMi-kyouka fe80662
added resume code checking endpoint and its handler
iZUMi-kyouka f3c9ea9
minor change to resume_code handler
iZUMi-kyouka 665ad2a
restore accidental deletion of function
iZUMi-kyouka abb1014
renamed resume_code to check_resume_code
iZUMi-kyouka 82afebf
added validation for enabling exam mode and setting resume code; dele…
iZUMi-kyouka 1db4420
added is_paused column and setting functionality to mitigate students…
iZUMi-kyouka d88eeba
added migrations for is_paused_column
iZUMi-kyouka d9a97e3
Merge branch 'master' into exam_mode
GabrielCWT 40ea386
Remove unused tree
RichDom2185 7ae6f14
Fix format
RichDom2185 e62fcef
Merge branch 'master' into exam_mode
RichDom2185 e0330f2
Redate migrations to maintain total ordering
RichDom2185 d971fcd
fixed failing tests due to missing fields in factory method, and expe…
iZUMi-kyouka 40ce982
Merge branch 'exam_mode_user_paused_flag' into exam_mode
iZUMi-kyouka 0302764
makes latest course retrieval logic more concise
iZUMi-kyouka 7fcbc89
ran mix format on courses and user controller
iZUMi-kyouka cad39c8
added new endpoint to report lost/regain of user focus
iZUMi-kyouka 46af8d7
removed filters for supplying exam_mode_course to renderer function
iZUMi-kyouka 6531376
renamed check_resume_code to try_unpause_user; split up the logic int…
iZUMi-kyouka 3dcc288
removed unnecessary admin config renderer in user_view and admin_user…
iZUMi-kyouka 31bbf5a
excludes staff and admins from exam_mode restriction on courses retur…
iZUMi-kyouka 48c1b10
excludes staff and admins from exam_mode restriction on courses retur…
iZUMi-kyouka e0758fb
Revert "excludes staff and admins from exam_mode restriction on cours…
iZUMi-kyouka 9154177
Merge branch 'exam_mode' into exam_mode_user_focus_logging
iZUMi-kyouka 7bd79fd
created new user_browser_focus_log; and created its type definition, …
iZUMi-kyouka ed16cb4
removed redundant logic from focus logging controller
iZUMi-kyouka 22a5704
sets a default resume_code in migration; add random resume code gener…
iZUMi-kyouka 6cba5f5
fixed resume code validation to consider whitespace; formatting
iZUMi-kyouka f6ab358
added default resume_code value to schema definition in course.ex; ma…
iZUMi-kyouka b99a82d
improved swagger help text for resume_code field; fix formatting
iZUMi-kyouka 604b61b
fixed bug in resume_code validation; added tests for exam_mode, is_of…
iZUMi-kyouka ca082c9
formatting
iZUMi-kyouka 398bee0
formatting
iZUMi-kyouka 1c3d787
add moduledoc for focus log
iZUMi-kyouka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
defmodule Cadet.FocusLogs.FocusLog do | ||
@moduledoc """ | ||
The FocusLog entity represents a log of user's browser focus | ||
while using Source Academy under exam mode. | ||
""" | ||
use Cadet, :model | ||
|
||
alias Cadet.Accounts.User | ||
alias Cadet.Courses.Course | ||
|
||
@type t :: %__MODULE__{ | ||
user: User.t(), | ||
course: Course.t(), | ||
focus_type: integer() | ||
} | ||
|
||
schema "user_browser_focus_log" do | ||
belongs_to(:user, User) | ||
belongs_to(:course, Course) | ||
field(:time, :naive_datetime) | ||
field(:focus_type, :integer) | ||
end | ||
|
||
@required_fields ~w(user_id course_id time focus_type)a | ||
|
||
def changeset(focus_log, params) do | ||
focus_log | ||
|> cast(params, @required_fields) | ||
|> add_belongs_to_id_from_model([:user, :course], params) | ||
|> validate_required(@required_fields) | ||
end | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
defmodule Cadet.FocusLogs do | ||
@moduledoc """ | ||
Contains logic to manage user's browser focus log | ||
such as insertion | ||
""" | ||
alias Cadet.FocusLogs.FocusLog | ||
|
||
use Cadet, [:context, :display] | ||
|
||
def insert_log(user_id, course_id, focus_type) do | ||
insert_result = | ||
%FocusLog{} | ||
|> FocusLog.changeset(%{ | ||
user_id: user_id, | ||
course_id: course_id, | ||
time: DateTime.utc_now(), | ||
focus_type: focus_type | ||
}) | ||
|> Repo.insert() | ||
|
||
case insert_result do | ||
{:ok, log} -> {:ok, log} | ||
{:error, changeset} -> {:error, full_error_messages(changeset)} | ||
end | ||
end | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RichDom2185 thoughts?