Class: AssessmentObject

Inherits:
Object
  • Object
show all
Includes:
DataFactory, DateFactory, Foundry, StringFactory, Workflows
Defined in:
lib/sambal-cle/data_objects/assessment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Workflows

menu_link, #open_my_site_by_name, #reset

Constructor Details

#initialize(browser, opts = {}) ⇒ AssessmentObject

Returns a new instance of AssessmentObject.



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
# File 'lib/sambal-cle/data_objects/assessment.rb', line 31

def initialize(browser, opts={})
  @browser = browser

  defaults = {
    :title=>random_alphanums,
    :authors=>random_alphanums,
    :description=>random_alphanums,
    :parts=>[],
    :questions=>[],
    :available_date=>right_now,
    :due_date=>tomorrow,
    :retract_date=>next_week,
    :feedback_authoring=>:question_level_feedback,
    :feedback_delivery=>:no_feedback,
    :release=>:release_questions_and,
    :release_options=>[],
    :released_to=>:released_to_site,
    :navigation=>:linear_access,
    :submissions=>:unlimited_submissions,
    :late_handling=>:late_submissions_not_accepted,
    :submission_message=>random_alphanums,
    :final_page_url=>"http://www.rsmart.com",
    :student_ids=>:student_ids_seen
    # TODO: More to add
  }
  options = defaults.merge(opts)
  set_options(options)
  requires @site

  default_part = make PartObject, :title=>"Default", :assessment=>@title, :part_number=>1, :information=>""
  @parts << default_part
end

Instance Attribute Details

#allowed_ipsObject

Returns the value of attribute allowed_ips.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def allowed_ips
  @allowed_ips
end

#available_dateObject

Returns the value of attribute available_date.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def available_date
  @available_date
end

#due_dateObject

Returns the value of attribute due_date.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def due_date
  @due_date
end

#feedback_authoringObject

Returns the value of attribute feedback_authoring.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def feedback_authoring
  @feedback_authoring
end

#feedback_dateObject

Returns the value of attribute feedback_date.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def feedback_date
  @feedback_date
end

#feedback_deliveryObject

Returns the value of attribute feedback_delivery.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def feedback_delivery
  @feedback_delivery
end

#final_page_urlObject

Returns the value of attribute final_page_url.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def final_page_url
  @final_page_url
end

#gradebook_optionsObject

Returns the value of attribute gradebook_options.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def gradebook_options
  @gradebook_options
end

#late_handlingObject

Returns the value of attribute late_handling.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def late_handling
  @late_handling
end

Returns the value of attribute navigation.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def navigation
  @navigation
end

#num_submissionsObject

Returns the value of attribute num_submissions.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def num_submissions
  @num_submissions
end

#numberingObject

Returns the value of attribute numbering.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def numbering
  @numbering
end

#partsObject

Returns the value of attribute parts.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def parts
  @parts
end

#question_layoutObject

Returns the value of attribute question_layout.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def question_layout
  @question_layout
end

#questionsObject

Returns the value of attribute questions.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def questions
  @questions
end

#recorded_scoreObject

Returns the value of attribute recorded_score.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def recorded_score
  @recorded_score
end

#releaseObject

Returns the value of attribute release.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def release
  @release
end

#release_optionsObject

Returns the value of attribute release_options.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def release_options
  @release_options
end

#release_toObject

Returns the value of attribute release_to.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def release_to
  @release_to
end

#retract_dateObject

Returns the value of attribute retract_date.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def retract_date
  @retract_date
end

#secondary_idObject

Returns the value of attribute secondary_id.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def secondary_id
  @secondary_id
end

#secondary_passwordObject

Returns the value of attribute secondary_password.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def secondary_password
  @secondary_password
end

#siteObject

Returns the value of attribute site.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def site
  @site
end

#statusObject

Returns the value of attribute status.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def status
  @status
end

#student_idsObject

Returns the value of attribute student_ids.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def student_ids
  @student_ids
end

#submission_messageObject

Returns the value of attribute submission_message.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def submission_message
  @submission_message
end

#submissionsObject

Returns the value of attribute submissions.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def submissions
  @submissions
end

#titleObject

Returns the value of attribute title.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def title
  @title
end

#typeObject

Returns the value of attribute type.



24
25
26
# File 'lib/sambal-cle/data_objects/assessment.rb', line 24

def type
  @type
end

Instance Method Details

#add_part(opts = {}) ⇒ Object



146
147
148
149
150
151
152
153
154
155
156
# File 'lib/sambal-cle/data_objects/assessment.rb', line 146

def add_part opts={}
  position
  defaults = {
    :assessment=>@title,
    :part_number=>@parts.length+1
  }
  options = defaults.merge(opts)
  part = make PartObject, options
  part.create
  @parts << part
end

#add_question(opts = {}) ⇒ Object



158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/sambal-cle/data_objects/assessment.rb', line 158

def add_question opts={}
  position
  defaults = {
      :assessment=>@title,
      :part=>@parts[rand(@parts.length)].title,
      :type=>question_types.keys.shuffle[0]
  }
  options = defaults.merge(opts)
  question = make question_types[options[:type].to_sym], options
  question.create
  @questions << question
end

#createObject



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/sambal-cle/data_objects/assessment.rb', line 64

def create
  open_my_site_by_name @site
  tests_and_quizzes
  reset
  on_page AssessmentsList do |page|
    page.title.set @title
    page.type.select @type unless @type==nil
    page.create
  end
  on EditAssessment do |assessment|
    assessment.settings
  end
  on AssessmentSettings do |settings|
    settings.open
    # Introduction
    settings.authors.set @authors
    settings.description.set @description
    # Delivery Dates
    settings.available_date.set @available_date[:samigo]
    settings.due_date.set @due_date[:samigo]
    settings.retract_date.set @retract_date[:samigo]
    # Assessment Released To
    settings.send(@released_to).set
    # High Security
    settings.allow_specified_ips.set @allowed_ips
    settings.secondary_id.set @secondary_id
    settings.secondary_pw.set @secondary_password
    # Assessment Organization
    settings.send(@navigation).set
    if @navigation==:random_access
      settings.send(@question_layout).set
      settings.send(@numbering).set
    # Mark for Review
      settings.send(@mark_for_review)
    end
    # Submissions
    settings.send(@submissions).set
    if @submissions==:only_x_submissions
      settings.allowed_submissions.set @num_submissions
    end
    settings.send(@late_handling).set
    # Submission Message
    settings.submission_message.set @submission_message
    settings.final_page_url.set @final_page_url
    # Feedback
    settings.send(@feedback_authoring).set
    settings.send(@feedback_delivery).set
    settings.send(@release).set
    @release_options.each do |option|
      settings.send(option).set
    end
    if @feedback_delivery==:feedback_on_date
      settings.feedback_date.set @feedback_date
    end
    # Grading
    # TODO: More to add here
    # Graphics

    # Metadata


    settings.save
  end
end

#publishObject



134
135
136
137
138
139
140
141
142
143
144
# File 'lib/sambal-cle/data_objects/assessment.rb', line 134

def publish
  open_my_site_by_name @site
  tests_and_quizzes
  reset
  on AssessmentsList do |list|
    list.publish @title
  end
  on PublishAssessment do |assessment|
    assessment.publish
  end
end

#question_typesObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sambal-cle/data_objects/assessment.rb', line 9

def question_types
  {
    :"Multiple Choice"=>MultipleChoiceQuestion,
    :Survey=>SurveyQuestion,
    :"Short Answer/Essay"=>ShortAnswerQuestion,
    :"Fill in the Blank"=>FillInBlankQuestion,
    :"Numeric Response"=>NumericResponseQuestion,
    :Matching=>MatchingQuestion,
    :"True False"=>TrueFalseQuestion,
    :"Audio Recording"=>AudioRecordingQuestion,
    :"File Upload"=>FileUploadQuestion,
    :"Calculated Question"=>CalculatedQuestion
  }
end

#update_settings(opts = {}) ⇒ Object



129
130
131
132
# File 'lib/sambal-cle/data_objects/assessment.rb', line 129

def update_settings opts={}

  set_options(opts)
end