Class: AtomicAssessmentsImport::Questions::Matching

Inherits:
Question
  • Object
show all
Defined in:
lib/atomic_assessments_import/questions/matching.rb

Constant Summary collapse

INDEXES =
("a".."o").to_a.freeze

Instance Attribute Summary

Attributes inherited from Question

#reference

Instance Method Summary collapse

Methods inherited from Question

#initialize, load, #metadata, #points, #scoring_type, #to_learnosity

Constructor Details

This class inherits a constructor from AtomicAssessmentsImport::Questions::Question

Instance Method Details

#question_dataObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/atomic_assessments_import/questions/matching.rb', line 14

def question_data
  stimulus_list = []
  possible_responses = []
  valid_values = []

  INDEXES.each do |letter|
    option = @row["option #{letter}"]
    match_val = @row["match #{letter}"]
    break unless option

    stimulus_list << option
    possible_responses << match_val if match_val
    valid_values << match_val if match_val
  end

  super.merge(
    stimulus_list: stimulus_list,
    possible_responses: possible_responses,
    validation: {
      valid_response: {
        score: points,
        value: valid_values,
      },
    }
  )
end

#question_typeObject



10
11
12
# File 'lib/atomic_assessments_import/questions/matching.rb', line 10

def question_type
  "association"
end