-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new:numbas feature backend intital commit
first commit containing endpoints and DB changes new faeture
- Loading branch information
Showing
4 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,36 @@ | ||
class TestAttempt < ApplicationRecord | ||
include ApplicationHelper | ||
include LogHelper | ||
include GradeHelper | ||
|
||
belongs_to :task | ||
|
||
def self.permissions | ||
student_role_permissions = [ | ||
:create, | ||
:view_own, | ||
:delete_own | ||
] | ||
|
||
tutor_role_permissions = [ | ||
:create, | ||
:view_own, | ||
:delete_own | ||
] | ||
|
||
convenor_role_permissions = [ | ||
:create, | ||
:view_own, | ||
:delete_own | ||
] | ||
|
||
nil_role_permissions = [] | ||
|
||
{ | ||
student: student_role_permissions, | ||
tutor: tutor_role_permissions, | ||
convenor: convenor_role_permissions, | ||
nil: nil_role_permissions | ||
} | ||
end | ||
end |
This file contains 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,16 @@ | ||
class CreateTestAttempts < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :test_attempts do |t| | ||
t.references :task, foreign_key: true | ||
t.string :name | ||
t.integer :attempt_number, default: 1, null: false | ||
t.boolean :pass_status | ||
t.text :exam_data | ||
t.boolean :completed, default: false | ||
t.datetime :attempted_at | ||
t.string :cmi_entry, default: "ab-initio" | ||
t.string :exam_result | ||
t.timestamps | ||
end | ||
end | ||
end |
This file contains 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,19 @@ | ||
class AddFieldsToTaskDef < ActiveRecord::Migration[7.0] | ||
def change | ||
change_table :task_definitions do |t| | ||
t.boolean :has_test, default: false | ||
t.boolean :restrict_attempts, default: false | ||
t.integer :delay_restart_minutes | ||
t.boolean :retake_on_resubmit, default: false | ||
end | ||
end | ||
|
||
def down | ||
change_table :task_definitions do |t| | ||
t.remove :has_test | ||
t.remove :restrict_attempts | ||
t.remove :delay_restart_minutes | ||
t.remove :retake_on_resubmit | ||
end | ||
end | ||
end |
This file contains 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