Class: OpenAssessment
- Inherits:
-
Object
- Object
- OpenAssessment
- Defined in:
- lib/ruql/open_assessment/open_assessment.rb
Constant Summary collapse
- @@single_question_scores =
[[5, "Excellent", "You got all of the question correct"], [4, "Great", "You got most of the question correct"], [3, "Good", "You got half of the question correct"], [2, "Fair", "You got parts of the question correct"], [1, "OK", "You got bits of the question correct"], [0, "Poor", "You got none of the question correct"]]
- @@DATE_REGEX =
/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/
Instance Attribute Summary collapse
-
#allow_file_upload ⇒ Object
Returns the value of attribute allow_file_upload.
-
#allow_latex ⇒ Object
Returns the value of attribute allow_latex.
-
#answer(answer) ⇒ Object
Sets the answers for a simple_open_assessment question.
-
#criterions ⇒ Object
Returns the value of attribute criterions.
-
#graded_by ⇒ Object
Returns the value of attribute graded_by.
-
#must_grade ⇒ Object
Returns the value of attribute must_grade.
-
#name ⇒ Object
Returns the value of attribute name.
-
#peer_review ⇒ Object
Returns the value of attribute peer_review.
-
#peer_review_due ⇒ Object
Returns the value of attribute peer_review_due.
-
#peer_review_due_time ⇒ Object
Returns the value of attribute peer_review_due_time.
-
#peer_review_start ⇒ Object
Returns the value of attribute peer_review_start.
-
#peer_review_start_time ⇒ Object
Returns the value of attribute peer_review_start_time.
-
#prompts ⇒ Object
Returns the value of attribute prompts.
-
#question_feedback_default_text ⇒ Object
Returns the value of attribute question_feedback_default_text.
-
#question_feedback_prompt ⇒ Object
Returns the value of attribute question_feedback_prompt.
-
#question_scoring_guideline ⇒ Object
Returns the value of attribute question_scoring_guideline.
-
#question_title ⇒ Object
Returns the value of attribute question_title.
-
#self_assessment ⇒ Object
Returns the value of attribute self_assessment.
-
#self_assessment_due ⇒ Object
Returns the value of attribute self_assessment_due.
-
#self_assessment_due_time ⇒ Object
Returns the value of attribute self_assessment_due_time.
-
#self_assessment_start ⇒ Object
Returns the value of attribute self_assessment_start.
-
#self_assessment_start_time ⇒ Object
Returns the value of attribute self_assessment_start_time.
-
#submission_due ⇒ Object
Returns the value of attribute submission_due.
-
#submission_due_time ⇒ Object
Returns the value of attribute submission_due_time.
-
#submission_start ⇒ Object
Returns the value of attribute submission_start.
-
#submission_start_time ⇒ Object
Returns the value of attribute submission_start_time.
-
#trainings ⇒ Object
Returns the value of attribute trainings.
-
#url_name ⇒ Object
Returns the value of attribute url_name.
-
#yaml ⇒ Object
Returns the value of attribute yaml.
Instance Method Summary collapse
-
#add_simple_question ⇒ Object
Adds fields for a simple_open_assessment question.
-
#criterion(*args, &block) ⇒ Object
Adds a criterion and evaluates its proc block.
-
#feedback_default_text(fb_text) ⇒ Object
Sets the default text for the feedback textarea.
-
#feedback_prompt(fb_prompt) ⇒ Object
Sets the feedback prompt if you want students to leave feedback.
-
#initialize(options = {}, yaml = {}) ⇒ OpenAssessment
constructor
Initializes the open assessment question.
-
#prompt(prompt) ⇒ Object
Adds a prompt to the question - you must have at least one.
-
#scoring_guideline(score_array) ⇒ Object
Sets the scoring guidelines for a simple_open_assesment question.
-
#student_training(*args, &block) ⇒ Object
Adds a student training question - only used with peer review enabled questions.
-
#title(title) ⇒ Object
Sets the title of the question.
Constructor Details
#initialize(options = {}, yaml = {}) ⇒ OpenAssessment
Initializes the open assessment question
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 31 def initialize(={}, yaml={}) @peer_review = [:peer_review] || false @self_assessment = [:self_assessment] @self_assessment = true if @self_assessment.nil? @prompts = [] @criterions = [] @trainings = [] @url_name = [:url_name] || SecureRandom.hex @yaml = yaml @must_grade = @yaml["must_grade"] || 5 @graded_by = @yaml["graded_by"] || 3 @allow_file_upload = [:allow_file_upload] || false @allow_latex = [:allow_latex] || false # Parsing start/due dates start_date = @yaml["submission_start"] || Time.now.to_s end_date = @yaml["submission_due"] || (Time.now + 14).to_s peer_review_start = @yaml["peer_review_start"] || start_date peer_review_due = @yaml["peer_review_due"] || end_date self_assessment_start = @yaml["self_assessment_start"] || start_date self_assessment_due = @yaml["self_assessment_due"] || end_date @submission_start = Date.parse(start_date) @submission_due = Date.parse(end_date) @submission_start_time = @yaml["submission_start_time"] || "00:00" @submission_due_time = @yaml["submission_due_time"] || "00:00" @peer_review_start = Date.parse(peer_review_start) @peer_review_due = Date.parse(peer_review_due) @peer_review_start_time = @yaml["peer_review_start_time"] || "00:00" @peer_review_due_time = @yaml["peer_review_due_time"] || "00:00" @self_assessment_start = Date.parse(self_assessment_start) @self_assessment_due = Date.parse(self_assessment_due) @self_assessment_start_time = @yaml["self_assessment_start_time"] || "00:00" @self_assessment_due_time = @yaml["self_assessment_due_time"] || "00:00" # Default feedback settings @question_feedback_prompt = "Leave feedback" @question_feedback_default_text = "Let them know how they did" end |
Instance Attribute Details
#allow_file_upload ⇒ Object
Returns the value of attribute allow_file_upload.
7 8 9 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 7 def allow_file_upload @allow_file_upload end |
#allow_latex ⇒ Object
Returns the value of attribute allow_latex.
7 8 9 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 7 def allow_latex @allow_latex end |
#answer(answer) ⇒ Object
Sets the answers for a simple_open_assessment question
89 90 91 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 89 def answer @answer end |
#criterions ⇒ Object
Returns the value of attribute criterions.
4 5 6 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 4 def criterions @criterions end |
#graded_by ⇒ Object
Returns the value of attribute graded_by.
4 5 6 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 4 def graded_by @graded_by end |
#must_grade ⇒ Object
Returns the value of attribute must_grade.
4 5 6 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 4 def must_grade @must_grade end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 4 def name @name end |
#peer_review ⇒ Object
Returns the value of attribute peer_review.
4 5 6 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 4 def peer_review @peer_review end |
#peer_review_due ⇒ Object
Returns the value of attribute peer_review_due.
8 9 10 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 8 def peer_review_due @peer_review_due end |
#peer_review_due_time ⇒ Object
Returns the value of attribute peer_review_due_time.
8 9 10 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 8 def peer_review_due_time @peer_review_due_time end |
#peer_review_start ⇒ Object
Returns the value of attribute peer_review_start.
8 9 10 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 8 def peer_review_start @peer_review_start end |
#peer_review_start_time ⇒ Object
Returns the value of attribute peer_review_start_time.
8 9 10 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 8 def peer_review_start_time @peer_review_start_time end |
#prompts ⇒ Object
Returns the value of attribute prompts.
4 5 6 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 4 def prompts @prompts end |
#question_feedback_default_text ⇒ Object
Returns the value of attribute question_feedback_default_text.
14 15 16 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 14 def question_feedback_default_text @question_feedback_default_text end |
#question_feedback_prompt ⇒ Object
Returns the value of attribute question_feedback_prompt.
14 15 16 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 14 def question_feedback_prompt @question_feedback_prompt end |
#question_scoring_guideline ⇒ Object
Returns the value of attribute question_scoring_guideline.
17 18 19 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 17 def question_scoring_guideline @question_scoring_guideline end |
#question_title ⇒ Object
Returns the value of attribute question_title.
4 5 6 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 4 def question_title @question_title end |
#self_assessment ⇒ Object
Returns the value of attribute self_assessment.
4 5 6 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 4 def self_assessment @self_assessment end |
#self_assessment_due ⇒ Object
Returns the value of attribute self_assessment_due.
8 9 10 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 8 def self_assessment_due @self_assessment_due end |
#self_assessment_due_time ⇒ Object
Returns the value of attribute self_assessment_due_time.
8 9 10 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 8 def self_assessment_due_time @self_assessment_due_time end |
#self_assessment_start ⇒ Object
Returns the value of attribute self_assessment_start.
8 9 10 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 8 def self_assessment_start @self_assessment_start end |
#self_assessment_start_time ⇒ Object
Returns the value of attribute self_assessment_start_time.
8 9 10 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 8 def self_assessment_start_time @self_assessment_start_time end |
#submission_due ⇒ Object
Returns the value of attribute submission_due.
8 9 10 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 8 def submission_due @submission_due end |
#submission_due_time ⇒ Object
Returns the value of attribute submission_due_time.
8 9 10 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 8 def submission_due_time @submission_due_time end |
#submission_start ⇒ Object
Returns the value of attribute submission_start.
8 9 10 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 8 def submission_start @submission_start end |
#submission_start_time ⇒ Object
Returns the value of attribute submission_start_time.
8 9 10 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 8 def submission_start_time @submission_start_time end |
#trainings ⇒ Object
Returns the value of attribute trainings.
16 17 18 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 16 def trainings @trainings end |
#url_name ⇒ Object
Returns the value of attribute url_name.
4 5 6 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 4 def url_name @url_name end |
#yaml ⇒ Object
Returns the value of attribute yaml.
15 16 17 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 15 def yaml @yaml end |
Instance Method Details
#add_simple_question ⇒ Object
Adds fields for a simple_open_assessment question
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 116 def add_simple_question criterion = Criterion.new criterion.name("How'd you do?") criterion.label("Scoring Rubric") raise "Must have answer for question" if @question_answer.nil? criterion.prompt(@question_answer) criterions << criterion scoring_guidelines = @question_scoring_guideline || @@single_question_scores scoring_guidelines.each do |score_array| option = Option.new({ points: score_array[0] }) option.add_params(score_array) criterion.add_option(option) end end |
#criterion(*args, &block) ⇒ Object
Adds a criterion and evaluates its proc block.
105 106 107 108 109 110 111 112 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 105 def criterion(*args, &block) criterion = Criterion.new(*args) criterion.instance_eval(&block) raise "Missing criterion parameters" if criterion.missing_parameters? @criterions << criterion end |
#feedback_default_text(fb_text) ⇒ Object
Sets the default text for the feedback textarea
101 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 101 def feedback_default_text(fb_text) ; @question_feedback_default_text = fb_text ; end |
#feedback_prompt(fb_prompt) ⇒ Object
Sets the feedback prompt if you want students to leave feedback
97 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 97 def feedback_prompt(fb_prompt) ; @question_feedback_prompt = fb_prompt ; end |
#prompt(prompt) ⇒ Object
Adds a prompt to the question - you must have at least one
85 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 85 def prompt(prompt) ; @prompts << prompt ; end |
#scoring_guideline(score_array) ⇒ Object
Sets the scoring guidelines for a simple_open_assesment question
93 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 93 def scoring_guideline(score_array) ; @question_scoring_guideline = score_array ; end |
#student_training(*args, &block) ⇒ Object
Adds a student training question - only used with peer review enabled questions
135 136 137 138 139 140 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 135 def student_training(*args, &block) return unless @peer_review training = Training.new(*args) training.instance_eval(&block) @trainings << training end |
#title(title) ⇒ Object
Sets the title of the question
81 |
# File 'lib/ruql/open_assessment/open_assessment.rb', line 81 def title(title) ; @question_title = title ; end |