Class: CanvasQtiToLearnosityConverter::NumericalQuestion
- Inherits:
-
QuizQuestion
- Object
- QuizQuestion
- CanvasQtiToLearnosityConverter::NumericalQuestion
show all
- Defined in:
- lib/canvas_qti_to_learnosity_converter/questions/numerical.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
56
57
58
59
60
61
62
63
|
# File 'lib/canvas_qti_to_learnosity_converter/questions/numerical.rb', line 56
def add_learnosity_assets(assets, path, learnosity)
process_assets!(
assets,
path,
learnosity[:stimulus]
)
learnosity
end
|
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/canvas_qti_to_learnosity_converter/questions/numerical.rb', line 15
def ()
response_mins = @xml.css('item > resprocessing >
respcondition[continue="No"] > conditionvar vargte').map do |node|
node.content
end
response_maxs = @xml.css('item > resprocessing >
respcondition[continue="No"] > conditionvar varlte').map do |node|
node.content
end
answer_bounds = response_mins.zip(response_maxs).map do |bounds|
precision = [
bounds.first.split(".").last.length,
bounds.last.split(".").last.length
].max
{
center: ((bounds.first.to_f + bounds.last.to_f) / 2.0).round(precision),
pm: ((bounds.first.to_f - bounds.last.to_f) / 2.0).round(precision).abs,
}
end
valid_answers = answer_bounds.map do |bounds|
{
"value" => [{
"method" => "equivValue",
"value" => "#{bounds[:center]}\\pm#{bounds[:pm]}",
"score" => ,
}]
}
end
{
"scoring_type" => "exactMatch",
"valid_response" => valid_answers.shift,
"alt_responses" => valid_answers,
}
end
|
#to_learnosity ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'lib/canvas_qti_to_learnosity_converter/questions/numerical.rb', line 5
def to_learnosity
{
is_math: true,
type: "formulaV2",
stimulus: (),
template: "{{response}}",
validation: (),
}
end
|