Class: CanvasQtiToLearnosityConverter::MultipleChoiceQuestion
- Inherits:
-
QuizQuestion
- Object
- QuizQuestion
- CanvasQtiToLearnosityConverter::MultipleChoiceQuestion
show all
- Defined in:
- lib/canvas_qti_to_learnosity_converter/questions/multiple_choice.rb
Instance Method Summary
collapse
#convert, #dynamic_content_data, #extract_mattext, #extract_points_possible, #extract_stimulus, #initialize, #make_identifier, #process_assets!
Instance Method Details
#add_learnosity_assets(assets, path, learnosity) ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/canvas_qti_to_learnosity_converter/questions/multiple_choice.rb', line 49
def add_learnosity_assets(assets, path, learnosity)
process_assets!(
assets,
path,
learnosity[:stimulus]
)
learnosity[:options].each.with_index do |option, index|
process_assets!(
assets,
path,
option["label"]
)
end
learnosity
end
|
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/canvas_qti_to_learnosity_converter/questions/multiple_choice.rb', line 5
def ()
choices = @xml.css("item > presentation > response_lid > render_choice > response_label")
choices.map do |choice|
ident = choice.attribute("ident").value
{
"value" => ident,
"label" => (choice.css("material > mattext").first),
}
end
end
|
16
17
18
|
# File 'lib/canvas_qti_to_learnosity_converter/questions/multiple_choice.rb', line 16
def ()
@xml.css("item > presentation > response_lid").attribute("ident").value
end
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/canvas_qti_to_learnosity_converter/questions/multiple_choice.rb', line 20
def ()
resp_conditions = @xml.css("item > resprocessing > respcondition")
correct_condition = resp_conditions.select do |condition|
setvar = condition.css("setvar")
setvar.length === 1 && setvar.text === "100"
end.first
correct_value = correct_condition.css("varequal").text
{
"scoring_type" => "exactMatch",
"valid_response" => {
"value" => [correct_value],
"score" => ,
},
}
end
|
#to_learnosity ⇒ Object
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/canvas_qti_to_learnosity_converter/questions/multiple_choice.rb', line 38
def to_learnosity
{
stimulus: (),
options: (),
multiple_responses: false,
response_id: (),
type: "mcq",
validation: (),
}
end
|