qti 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/qti/v1/models/interactions/fill_blank_interaction.rb +9 -5
- data/lib/qti/v1/models/interactions/formula_interaction.rb +10 -6
- data/lib/qti/v1/models/stimulus_item.rb +2 -3
- data/lib/qti/version.rb +1 -1
- data/spec/lib/qti/v1/models/interactions/fill_blank_interaction_spec.rb +0 -1
- data/spec/lib/qti/v1/models/interactions/formula_interaction_spec.rb +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba499677e0990dbf44bf87be25231b89857bb35c
|
4
|
+
data.tar.gz: b96d68fb28cf9bf91a71d2442caebbfb687bfb4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04a5855e97432a00fd6d5e24200622eaf2b9625201c23129026e99254a250d378c19f668222d2be6a3dec7d8f4ac59ddd061c1acff73cfc9e96eb84712b8ad22
|
7
|
+
data.tar.gz: 8d31f22322d9e9e441880aa747332cf4e4a8796f1b0ed3cfcc4193ca3b9de9292e90b490048ddd7641d68cd6e717c4554a69b90c531aefb6e1121b2bba867973
|
@@ -41,11 +41,7 @@ module Qti
|
|
41
41
|
def qti_stem_items
|
42
42
|
stem_item_nodes = node.xpath('.//xmlns:presentation').children
|
43
43
|
stem_item_nodes.map.with_index do |stem_item, index|
|
44
|
-
|
45
|
-
stem_blank(index, stem_item.attributes['ident'].value)
|
46
|
-
else
|
47
|
-
stem_text(index, stem_item.children.text)
|
48
|
-
end
|
44
|
+
qti_stem_item(index, stem_item)
|
49
45
|
end
|
50
46
|
end
|
51
47
|
|
@@ -113,6 +109,14 @@ module Qti
|
|
113
109
|
def scoring_data_case(node)
|
114
110
|
node.attributes['case']&.value || 'no'
|
115
111
|
end
|
112
|
+
|
113
|
+
def qti_stem_item(index, stem_item)
|
114
|
+
if stem_item.xpath('./xmlns:render_fib').present?
|
115
|
+
stem_blank(index, stem_item.attributes['ident'].value)
|
116
|
+
else
|
117
|
+
stem_text(index, sanitize_content!(stem_item.children.text))
|
118
|
+
end
|
119
|
+
end
|
116
120
|
end
|
117
121
|
end
|
118
122
|
end
|
@@ -32,12 +32,7 @@ module Qti
|
|
32
32
|
def variables
|
33
33
|
varlist = @node.at_xpath('.//xmlns:vars')
|
34
34
|
varlist.xpath('.//xmlns:var').map do |vnode|
|
35
|
-
|
36
|
-
name: vnode.attributes['name']&.value,
|
37
|
-
min: vnode.at_xpath('.//xmlns:min').text,
|
38
|
-
max: vnode.at_xpath('.//xmlns:max').text,
|
39
|
-
precision: vnode.attributes['scale']&.value
|
40
|
-
}
|
35
|
+
variable_def(vnode)
|
41
36
|
end
|
42
37
|
end
|
43
38
|
|
@@ -70,6 +65,15 @@ module Qti
|
|
70
65
|
}
|
71
66
|
end
|
72
67
|
end
|
68
|
+
|
69
|
+
def variable_def(var_node)
|
70
|
+
{
|
71
|
+
name: var_node.attributes['name']&.value,
|
72
|
+
min: var_node.at_xpath('.//xmlns:min').text&.to_f,
|
73
|
+
max: var_node.at_xpath('.//xmlns:max').text&.to_f,
|
74
|
+
precision: var_node.attributes['scale']&.value&.to_i
|
75
|
+
}
|
76
|
+
end
|
73
77
|
end
|
74
78
|
end
|
75
79
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Qti
|
2
2
|
module V1
|
3
3
|
module Models
|
4
|
-
class StimulusItem
|
4
|
+
class StimulusItem < Qti::V1::Models::Base
|
5
5
|
def initialize(ref_node)
|
6
6
|
@node = ref_node
|
7
7
|
end
|
@@ -18,8 +18,7 @@ module Qti
|
|
18
18
|
@body ||= begin
|
19
19
|
presentation = @node.at_xpath('.//xmlns:presentation')
|
20
20
|
return nil if presentation.blank?
|
21
|
-
|
22
|
-
mattext&.text
|
21
|
+
sanitize_content!(presentation.at_xpath('.//xmlns:mattext')&.text)
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
data/lib/qti/version.rb
CHANGED
@@ -209,7 +209,6 @@ describe Qti::V1::Models::Interactions::FillBlankInteraction do
|
|
209
209
|
include_examples 'stem_items'
|
210
210
|
|
211
211
|
it 'returns false for #single_fill_in_blank?' do
|
212
|
-
puts "LOADED CLASS: #{loaded_class}"
|
213
212
|
expect(loaded_class.single_fill_in_blank?).to eq false
|
214
213
|
end
|
215
214
|
end
|
@@ -47,7 +47,7 @@ describe Qti::V1::Models::Interactions::FormulaInteraction do
|
|
47
47
|
|
48
48
|
let(:item_title) { '<div><p>What number is [x]</p></div>' }
|
49
49
|
|
50
|
-
let(:variables) { [{ name: 'x', min:
|
50
|
+
let(:variables) { [{ name: 'x', min: 1.0, max: 10.0, precision: 0 }] }
|
51
51
|
|
52
52
|
include_examples 'scoring_data_structs'
|
53
53
|
include_examples 'reading_formulas'
|
@@ -68,8 +68,8 @@ describe Qti::V1::Models::Interactions::FormulaInteraction do
|
|
68
68
|
let(:item_title) { '<div><p>[x] + [y]</p></div>' }
|
69
69
|
|
70
70
|
let(:variables) do
|
71
|
-
[{ name: 'x', min:
|
72
|
-
{ name: 'y', min:
|
71
|
+
[{ name: 'x', min: 1.0, max: 10.0, precision: 0 },
|
72
|
+
{ name: 'y', min: 1.0, max: 10.0, precision: 0 }]
|
73
73
|
end
|
74
74
|
|
75
75
|
include_examples 'scoring_data_structs'
|
@@ -91,10 +91,10 @@ describe Qti::V1::Models::Interactions::FormulaInteraction do
|
|
91
91
|
let(:item_title) { '<div><p>[n][x] + [m][y]</p></div>' }
|
92
92
|
|
93
93
|
let(:variables) do
|
94
|
-
[{ name: 'y', min:
|
95
|
-
{ name: 'x', min:
|
96
|
-
{ name: 'n', min:
|
97
|
-
{ name: 'm', min:
|
94
|
+
[{ name: 'y', min: 1.0, max: 10.0, precision: 2 },
|
95
|
+
{ name: 'x', min: 1.0, max: 10.0, precision: 2 },
|
96
|
+
{ name: 'n', min: 1.0, max: 10.0, precision: 2 },
|
97
|
+
{ name: 'm', min: 1.0, max: 10.0, precision: 2 }]
|
98
98
|
end
|
99
99
|
|
100
100
|
include_examples 'scoring_data_structs'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hannah Bottalla
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|