Class: Qti::Models::AssessmentMeta

Inherits:
Base
  • Object
show all
Defined in:
lib/qti/models/assessment_meta.rb

Overview

rubocop:disable Metrics/ClassLength

Instance Attribute Summary

Attributes inherited from Base

#doc, #manifest, #package_root, #path, #resource

Instance Method Summary collapse

Methods inherited from Base

#css_with_single_check, from_path!, #initialize, #parse_html, #parse_xml, #preprocess_xml_doc, #raise_unsupported, #remap_href_path, #sanitize_content!, #xpath_with_single_check

Constructor Details

This class inherits a constructor from Qti::Models::Base

Instance Method Details

#access_codeObject



165
166
167
168
169
# File 'lib/qti/models/assessment_meta.rb', line 165

def access_code
  code = sanitize_content!(tag_under_quiz('access_code'))
  return nil if code.to_s.empty?
  code
end

#allow_clear_mc_selectionObject



192
193
194
# File 'lib/qti/models/assessment_meta.rb', line 192

def allow_clear_mc_selection
  tag_under_quiz('allow_clear_mc_selection')
end

#allow_clear_mc_selection?Boolean

Returns:

  • (Boolean)


196
197
198
# File 'lib/qti/models/assessment_meta.rb', line 196

def allow_clear_mc_selection?
  string_true?(allow_clear_mc_selection)
end

#allowed_attemptsObject



89
90
91
# File 'lib/qti/models/assessment_meta.rb', line 89

def allowed_attempts
  allowed_attempts_raw.to_i
end

#allowed_attempts_rawObject



85
86
87
# File 'lib/qti/models/assessment_meta.rb', line 85

def allowed_attempts_raw
  tag_under_quiz('allowed_attempts')
end

#anonymous_submissionsObject



69
70
71
# File 'lib/qti/models/assessment_meta.rb', line 69

def anonymous_submissions
  tag_under_quiz('anonymous_submissions')
end

#anonymous_submissions?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/qti/models/assessment_meta.rb', line 73

def anonymous_submissions?
  string_true?(anonymous_submissions)
end

#availableObject



109
110
111
# File 'lib/qti/models/assessment_meta.rb', line 109

def available
  tag_under_quiz('available')
end

#available?Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/qti/models/assessment_meta.rb', line 113

def available?
  string_true?(available)
end

#calculator_typeObject



29
30
31
# File 'lib/qti/models/assessment_meta.rb', line 29

def calculator_type
  tag_under_quiz('calculator_type')
end

#cant_go_backObject



101
102
103
# File 'lib/qti/models/assessment_meta.rb', line 101

def cant_go_back
  tag_under_quiz('cant_go_back')
end

#cant_go_back?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/qti/models/assessment_meta.rb', line 105

def cant_go_back?
  string_true?(cant_go_back)
end

#cooling_period_secondsObject



45
46
47
# File 'lib/qti/models/assessment_meta.rb', line 45

def cooling_period_seconds
  cooling_period_seconds_raw&.to_i
end

#cooling_period_seconds_rawObject



41
42
43
# File 'lib/qti/models/assessment_meta.rb', line 41

def cooling_period_seconds_raw
  tag_under_quiz('cooling_period_seconds')
end

#could_be_lockedObject



77
78
79
# File 'lib/qti/models/assessment_meta.rb', line 77

def could_be_locked
  tag_under_quiz('could_be_locked')
end

#could_be_locked?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/qti/models/assessment_meta.rb', line 81

def could_be_locked?
  string_true?(could_be_locked)
end

#descriptionObject



9
10
11
# File 'lib/qti/models/assessment_meta.rb', line 9

def description
  sanitize_content!(tag_under_quiz('description'))
end

#display_item_correct_answerObject



286
287
288
# File 'lib/qti/models/assessment_meta.rb', line 286

def display_item_correct_answer
  tag_under_quiz('display_item_correct_answer')
end

#display_item_correct_answer?Boolean

Returns:

  • (Boolean)


290
291
292
# File 'lib/qti/models/assessment_meta.rb', line 290

def display_item_correct_answer?
  string_true?(display_item_correct_answer)
end

#display_item_feedbackObject



254
255
256
# File 'lib/qti/models/assessment_meta.rb', line 254

def display_item_feedback
  tag_under_quiz('display_item_feedback')
end

#display_item_feedback?Boolean

Returns:

  • (Boolean)


258
259
260
# File 'lib/qti/models/assessment_meta.rb', line 258

def display_item_feedback?
  string_true?(display_item_feedback)
end

#display_item_responseObject



262
263
264
# File 'lib/qti/models/assessment_meta.rb', line 262

def display_item_response
  tag_under_quiz('display_item_response')
end

#display_item_response?Boolean

Returns:

  • (Boolean)


266
267
268
# File 'lib/qti/models/assessment_meta.rb', line 266

def display_item_response?
  string_true?(display_item_response)
end

#display_item_response_correctnessObject



294
295
296
# File 'lib/qti/models/assessment_meta.rb', line 294

def display_item_response_correctness
  tag_under_quiz('display_item_response_correctness')
end

#display_item_response_correctness?Boolean

Returns:

  • (Boolean)


298
299
300
# File 'lib/qti/models/assessment_meta.rb', line 298

def display_item_response_correctness?
  string_true?(display_item_response_correctness)
end

#display_itemsObject



246
247
248
# File 'lib/qti/models/assessment_meta.rb', line 246

def display_items
  tag_under_quiz('display_items')
end

#display_items?Boolean

Returns:

  • (Boolean)


250
251
252
# File 'lib/qti/models/assessment_meta.rb', line 250

def display_items?
  string_true?(display_items)
end

#display_points_awardedObject



270
271
272
# File 'lib/qti/models/assessment_meta.rb', line 270

def display_points_awarded
  tag_under_quiz('display_points_awarded')
end

#display_points_awarded?Boolean

Returns:

  • (Boolean)


274
275
276
# File 'lib/qti/models/assessment_meta.rb', line 274

def display_points_awarded?
  string_true?(display_points_awarded)
end

#display_points_possibleObject



278
279
280
# File 'lib/qti/models/assessment_meta.rb', line 278

def display_points_possible
  tag_under_quiz('display_points_possible')
end

#display_points_possible?Boolean

Returns:

  • (Boolean)


282
283
284
# File 'lib/qti/models/assessment_meta.rb', line 282

def display_points_possible?
  string_true?(display_points_possible)
end

#due_atObject



161
162
163
# File 'lib/qti/models/assessment_meta.rb', line 161

def due_at
  tag_under_quiz('due_at')
end

#hide_correct_answers_atObject



188
189
190
# File 'lib/qti/models/assessment_meta.rb', line 188

def hide_correct_answers_at
  tag_under_quiz('hide_correct_answers_at')
end

#hide_resultsObject



33
34
35
# File 'lib/qti/models/assessment_meta.rb', line 33

def hide_results
  tag_under_quiz('hide_results')
end

#ip_filterObject



171
172
173
# File 'lib/qti/models/assessment_meta.rb', line 171

def ip_filter
  tag_under_quiz('ip_filter')
end

#lock_atObject



153
154
155
# File 'lib/qti/models/assessment_meta.rb', line 153

def lock_at
  tag_under_quiz('lock_at')
end

#lockdown_browser_monitor_dataObject



224
225
226
# File 'lib/qti/models/assessment_meta.rb', line 224

def lockdown_browser_monitor_data
  tag_under_quiz('lockdown_browser_monitor_data')
end

#module_lockedObject



141
142
143
# File 'lib/qti/models/assessment_meta.rb', line 141

def module_locked
  tag_under_quiz('module_locked')
end

#module_locked?Boolean

Returns:

  • (Boolean)


145
146
147
# File 'lib/qti/models/assessment_meta.rb', line 145

def module_locked?
  string_true?(module_locked)
end

#nq_ip_filtersObject



228
229
230
231
232
# File 'lib/qti/models/assessment_meta.rb', line 228

def nq_ip_filters
  @doc.xpath('//xmlns:quiz/xmlns:nq_ip_filter').map do |ip_filter|
    [ip_filter.attributes['from']&.value, ip_filter.attributes['to']&.value]
  end
end

#nq_ip_filters_enabled?Boolean

Returns:

  • (Boolean)


234
235
236
# File 'lib/qti/models/assessment_meta.rb', line 234

def nq_ip_filters_enabled?
  nq_ip_filters.any?
end

#one_question_at_a_timeObject



93
94
95
# File 'lib/qti/models/assessment_meta.rb', line 93

def one_question_at_a_time
  tag_under_quiz('one_question_at_a_time')
end

#one_question_at_a_time?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/qti/models/assessment_meta.rb', line 97

def one_question_at_a_time?
  one_question_at_a_time == 'true'
end

#one_time_resultsObject



117
118
119
# File 'lib/qti/models/assessment_meta.rb', line 117

def one_time_results
  tag_under_quiz('one_time_results')
end

#one_time_results?Boolean

Returns:

  • (Boolean)


121
122
123
# File 'lib/qti/models/assessment_meta.rb', line 121

def one_time_results?
  string_true?(one_time_results)
end

#only_visible_to_overreidesObject



133
134
135
# File 'lib/qti/models/assessment_meta.rb', line 133

def only_visible_to_overreides
  tag_under_quiz('only_visible_to_overrides')
end

#only_visible_to_overrides?Boolean

Returns:

  • (Boolean)


137
138
139
# File 'lib/qti/models/assessment_meta.rb', line 137

def only_visible_to_overrides?
  string_true?(only_visible_to_overrides)
end

#points_possibleObject



57
58
59
# File 'lib/qti/models/assessment_meta.rb', line 57

def points_possible
  points_possible_raw.to_f
end

#points_possible_rawObject



53
54
55
# File 'lib/qti/models/assessment_meta.rb', line 53

def points_possible_raw
  tag_under_quiz('points_possible')
end

#quiz_identifierObject



149
150
151
# File 'lib/qti/models/assessment_meta.rb', line 149

def quiz_identifier
  @doc.xpath('//xmlns:quiz/xmlns:assignment/xmlns:quiz_identifierref')&.first&.content
end

#quiz_typeObject



49
50
51
# File 'lib/qti/models/assessment_meta.rb', line 49

def quiz_type
  tag_under_quiz('quiz_type')
end

#require_lockdown_browserObject



200
201
202
# File 'lib/qti/models/assessment_meta.rb', line 200

def require_lockdown_browser
  tag_under_quiz('require_lockdown_browser')
end

#require_lockdown_browser?Boolean

Returns:

  • (Boolean)


204
205
206
# File 'lib/qti/models/assessment_meta.rb', line 204

def require_lockdown_browser?
  string_true?(require_lockdown_browser)
end

#require_lockdown_browser_for_resultsObject



208
209
210
# File 'lib/qti/models/assessment_meta.rb', line 208

def require_lockdown_browser_for_results
  tag_under_quiz('require_lockdown_browser_for_results')
end

#require_lockdown_browser_for_results?Boolean

Returns:

  • (Boolean)


212
213
214
# File 'lib/qti/models/assessment_meta.rb', line 212

def require_lockdown_browser_for_results?
  string_true?(require_lockdown_browser_for_results)
end

#require_lockdown_browser_monitorObject



216
217
218
# File 'lib/qti/models/assessment_meta.rb', line 216

def require_lockdown_browser_monitor
  tag_under_quiz('require_lockdown_browser_monitor')
end

#require_lockdown_browser_monitor?Boolean

Returns:

  • (Boolean)


220
221
222
# File 'lib/qti/models/assessment_meta.rb', line 220

def require_lockdown_browser_monitor?
  string_true?(require_lockdown_browser_monitor)
end

#result_view_restrictedObject



238
239
240
# File 'lib/qti/models/assessment_meta.rb', line 238

def result_view_restricted
  tag_under_quiz('result_view_restricted')
end

#result_view_restricted?Boolean

Returns:

  • (Boolean)


242
243
244
# File 'lib/qti/models/assessment_meta.rb', line 242

def result_view_restricted?
  string_true?(result_view_restricted)
end

#scoring_policyObject



37
38
39
# File 'lib/qti/models/assessment_meta.rb', line 37

def scoring_policy
  tag_under_quiz('scoring_policy')
end

#show_correct_answersObject



61
62
63
# File 'lib/qti/models/assessment_meta.rb', line 61

def show_correct_answers
  tag_under_quiz('show_correct_answers')
end

#show_correct_answers?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/qti/models/assessment_meta.rb', line 65

def show_correct_answers?
  string_true?(show_correct_answers)
end

#show_correct_answers_atObject



184
185
186
# File 'lib/qti/models/assessment_meta.rb', line 184

def show_correct_answers_at
  tag_under_quiz('show_correct_answers_at')
end

#show_correct_answers_last_attemptObject



125
126
127
# File 'lib/qti/models/assessment_meta.rb', line 125

def show_correct_answers_last_attempt
  tag_under_quiz('show_correct_answers_last_attempt')
end

#show_correct_answers_last_attempt?Boolean

Returns:

  • (Boolean)


129
130
131
# File 'lib/qti/models/assessment_meta.rb', line 129

def show_correct_answers_last_attempt?
  string_true?(show_correct_answers_last_attempt)
end

#shuffle_answersObject



21
22
23
# File 'lib/qti/models/assessment_meta.rb', line 21

def shuffle_answers
  tag_under_quiz('shuffle_answers')
end

#shuffle_answers?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/qti/models/assessment_meta.rb', line 25

def shuffle_answers?
  string_true?(shuffle_answers)
end

#shuffle_questionsObject



13
14
15
# File 'lib/qti/models/assessment_meta.rb', line 13

def shuffle_questions
  tag_under_quiz('shuffle_questions')
end

#shuffle_questions?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/qti/models/assessment_meta.rb', line 17

def shuffle_questions?
  string_true?(shuffle_questions)
end

#time_limitObject



179
180
181
182
# File 'lib/qti/models/assessment_meta.rb', line 179

def time_limit
  return nil if time_limit_raw.nil?
  time_limit_raw.to_i
end

#time_limit_rawObject



175
176
177
# File 'lib/qti/models/assessment_meta.rb', line 175

def time_limit_raw
  tag_under_quiz('time_limit')
end

#titleObject



5
6
7
# File 'lib/qti/models/assessment_meta.rb', line 5

def title
  sanitize_content!(tag_under_quiz('title'))
end

#unlock_atObject



157
158
159
# File 'lib/qti/models/assessment_meta.rb', line 157

def unlock_at
  tag_under_quiz('unlock_at')
end