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



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

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

#allow_clear_mc_selectionObject



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

def allow_clear_mc_selection
  tag_under_quiz('allow_clear_mc_selection')
end

#allow_clear_mc_selection?Boolean

Returns:

  • (Boolean)


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

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



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

def available
  tag_under_quiz('available')
end

#available?Boolean

Returns:

  • (Boolean)


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

def available?
  string_true?(available)
end

#build_on_last_attemptObject



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

def build_on_last_attempt
  tag_under_quiz('build_on_last_attempt')
end

#build_on_last_attempt?Boolean

Returns:

  • (Boolean)


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

def build_on_last_attempt?
  string_true?(build_on_last_attempt)
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



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

def cant_go_back
  tag_under_quiz('cant_go_back')
end

#cant_go_back?Boolean

Returns:

  • (Boolean)


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

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



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

def display_item_correct_answer
  tag_under_quiz('display_item_correct_answer')
end

#display_item_correct_answer?Boolean

Returns:

  • (Boolean)


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

def display_item_correct_answer?
  string_true?(display_item_correct_answer)
end

#display_item_feedbackObject



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

def display_item_feedback
  tag_under_quiz('display_item_feedback')
end

#display_item_feedback?Boolean

Returns:

  • (Boolean)


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

def display_item_feedback?
  string_true?(display_item_feedback)
end

#display_item_responseObject



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

def display_item_response
  tag_under_quiz('display_item_response')
end

#display_item_response?Boolean

Returns:

  • (Boolean)


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

def display_item_response?
  string_true?(display_item_response)
end

#display_item_response_correctnessObject



302
303
304
# File 'lib/qti/models/assessment_meta.rb', line 302

def display_item_response_correctness
  tag_under_quiz('display_item_response_correctness')
end

#display_item_response_correctness?Boolean

Returns:

  • (Boolean)


306
307
308
# File 'lib/qti/models/assessment_meta.rb', line 306

def display_item_response_correctness?
  string_true?(display_item_response_correctness)
end

#display_item_response_correctness_qualifierObject



322
323
324
# File 'lib/qti/models/assessment_meta.rb', line 322

def display_item_response_correctness_qualifier
  tag_under_quiz('display_item_response_correctness_qualifier')
end

#display_item_response_qualifierObject



310
311
312
# File 'lib/qti/models/assessment_meta.rb', line 310

def display_item_response_qualifier
  tag_under_quiz('display_item_response_qualifier')
end

#display_itemsObject



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

def display_items
  tag_under_quiz('display_items')
end

#display_items?Boolean

Returns:

  • (Boolean)


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

def display_items?
  string_true?(display_items)
end

#display_points_awardedObject



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

def display_points_awarded
  tag_under_quiz('display_points_awarded')
end

#display_points_awarded?Boolean

Returns:

  • (Boolean)


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

def display_points_awarded?
  string_true?(display_points_awarded)
end

#display_points_possibleObject



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

def display_points_possible
  tag_under_quiz('display_points_possible')
end

#display_points_possible?Boolean

Returns:

  • (Boolean)


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

def display_points_possible?
  string_true?(display_points_possible)
end

#due_atObject



169
170
171
# File 'lib/qti/models/assessment_meta.rb', line 169

def due_at
  tag_under_quiz('due_at')
end

#hide_correct_answers_atObject



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

def hide_correct_answers_at
  tag_under_quiz('hide_correct_answers_at')
end

#hide_item_response_correctness_atObject



330
331
332
# File 'lib/qti/models/assessment_meta.rb', line 330

def hide_item_response_correctness_at
  tag_under_quiz('hide_item_response_correctness_at')
end

#hide_item_responses_atObject



318
319
320
# File 'lib/qti/models/assessment_meta.rb', line 318

def hide_item_responses_at
  tag_under_quiz('hide_item_responses_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



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

def ip_filter
  tag_under_quiz('ip_filter')
end

#lock_atObject



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

def lock_at
  tag_under_quiz('lock_at')
end

#lockdown_browser_monitor_dataObject



232
233
234
# File 'lib/qti/models/assessment_meta.rb', line 232

def lockdown_browser_monitor_data
  tag_under_quiz('lockdown_browser_monitor_data')
end

#module_lockedObject



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

def module_locked
  tag_under_quiz('module_locked')
end

#module_locked?Boolean

Returns:

  • (Boolean)


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

def module_locked?
  string_true?(module_locked)
end

#nq_ip_filtersObject



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

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)


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

def nq_ip_filters_enabled?
  nq_ip_filters.any?
end

#one_question_at_a_timeObject



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

def one_question_at_a_time
  tag_under_quiz('one_question_at_a_time')
end

#one_question_at_a_time?Boolean

Returns:

  • (Boolean)


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

def one_question_at_a_time?
  one_question_at_a_time == 'true'
end

#one_time_resultsObject



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

def one_time_results
  tag_under_quiz('one_time_results')
end

#one_time_results?Boolean

Returns:

  • (Boolean)


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

def one_time_results?
  string_true?(one_time_results)
end

#only_visible_to_overridesObject



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

def only_visible_to_overrides
  tag_under_quiz('only_visible_to_overrides')
end

#only_visible_to_overrides?Boolean

Returns:

  • (Boolean)


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

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



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

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



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

def require_lockdown_browser
  tag_under_quiz('require_lockdown_browser')
end

#require_lockdown_browser?Boolean

Returns:

  • (Boolean)


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

def require_lockdown_browser?
  string_true?(require_lockdown_browser)
end

#require_lockdown_browser_for_resultsObject



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

def require_lockdown_browser_for_results
  tag_under_quiz('require_lockdown_browser_for_results')
end

#require_lockdown_browser_for_results?Boolean

Returns:

  • (Boolean)


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

def require_lockdown_browser_for_results?
  string_true?(require_lockdown_browser_for_results)
end

#require_lockdown_browser_monitorObject



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

def require_lockdown_browser_monitor
  tag_under_quiz('require_lockdown_browser_monitor')
end

#require_lockdown_browser_monitor?Boolean

Returns:

  • (Boolean)


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

def require_lockdown_browser_monitor?
  string_true?(require_lockdown_browser_monitor)
end

#result_view_restrictedObject



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

def result_view_restricted
  tag_under_quiz('result_view_restricted')
end

#result_view_restricted?Boolean

Returns:

  • (Boolean)


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

def result_view_restricted?
  string_true?(result_view_restricted) || false if 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



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

def show_correct_answers_at
  tag_under_quiz('show_correct_answers_at')
end

#show_correct_answers_last_attemptObject



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

def show_correct_answers_last_attempt
  tag_under_quiz('show_correct_answers_last_attempt')
end

#show_correct_answers_last_attempt?Boolean

Returns:

  • (Boolean)


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

def show_correct_answers_last_attempt?
  string_true?(show_correct_answers_last_attempt)
end

#show_item_response_correctness_atObject



326
327
328
# File 'lib/qti/models/assessment_meta.rb', line 326

def show_item_response_correctness_at
  tag_under_quiz('show_item_response_correctness_at')
end

#show_item_responses_atObject



314
315
316
# File 'lib/qti/models/assessment_meta.rb', line 314

def show_item_responses_at
  tag_under_quiz('show_item_responses_at')
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



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

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

#time_limit_rawObject



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

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



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

def unlock_at
  tag_under_quiz('unlock_at')
end