Class: CanvasQtiToLearnosityConverter::FillTheBlanksQuestion
Instance Method Summary
collapse
#extract_template, #extract_template_values, #get_template
#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
14
15
16
17
18
19
20
21
|
# File 'lib/canvas_qti_to_learnosity_converter/questions/fill_the_blanks.rb', line 14
def add_learnosity_assets(assets, path, learnosity)
process_assets!(
assets,
path,
learnosity[:template]
)
learnosity
end
|
#create_responses(blank_responses, depth, result, current_response) ⇒ Object
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/canvas_qti_to_learnosity_converter/questions/fill_the_blanks.rb', line 51
def create_responses(blank_responses, depth, result, current_response)
if depth == blank_responses.count
result.push({ "score" => , "value" => current_response })
return
end
blank_responses[depth].each do |possible_response|
create_responses(blank_responses, depth + 1, result, current_response + [possible_response])
end
end
|
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/canvas_qti_to_learnosity_converter/questions/fill_the_blanks.rb', line 23
def ()
template = get_template()
responses = (template).map do |name|
result = @xml.css(%{item > presentation >
response_lid[ident="response_#{name}"] > render_choice material >
mattext}).map do |node|
(node)
end
if result.empty?
nil
else
result
end
end.compact
all_responses = []
create_responses(responses, 0, all_responses, [])
{
"scoring_type" => "partialMatchV2",
"rounding" => "none",
"valid_response" => all_responses.shift,
"alt_responses" => all_responses
}
end
|
#to_learnosity ⇒ Object
5
6
7
8
9
10
11
12
|
# File 'lib/canvas_qti_to_learnosity_converter/questions/fill_the_blanks.rb', line 5
def to_learnosity
{
type: "clozetext",
stimulus: "",
template: (),
validation: (),
}
end
|