qti 2.11.0 → 2.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qti/v2/models/assessment_item.rb +1 -1
- data/lib/qti/v2/models/interactions/gap_match_interaction.rb +14 -7
- data/lib/qti/version.rb +1 -1
- data/spec/lib/qti/v2/models/assessment_item_spec.rb +17 -0
- data/spec/lib/qti/v2/models/interactions/gap_match_interaction_spec.rb +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f9b01aa2a3dd926eecc38def85058a183d1cdc137e7b2fdb7e57e53d039ec8d
|
4
|
+
data.tar.gz: 947616c8831529af2441ff21f24202be5a09a0edf14ed285576840c595019e25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56801239a3801104cf1f79bd485fbeb45485b694360d4f2e98cc1edeaa3945b3c5aa85ccc9cdf282d5ee8657dc55b70731087cce0b65749fc9b12cf2c583819d
|
7
|
+
data.tar.gz: 9aee853c6af495ae4349aec0f429b17ec8d61cf46c952d5b96f92f63d0b6e5334332bd56249106c7df616fac44d7e4d0be9a28da4abff65528c22fa82029ede4
|
@@ -10,7 +10,7 @@ module Qti
|
|
10
10
|
# ensure a prompt is carried into the html
|
11
11
|
prompt = node.at_xpath('//xmlns:prompt')
|
12
12
|
filter_item_body(node)
|
13
|
-
node.add_child(prompt) if prompt&.parent && prompt.parent != node
|
13
|
+
node.add_child(prompt&.dup) if prompt&.parent && prompt.parent != node
|
14
14
|
sanitize_content!(node.to_html)
|
15
15
|
end
|
16
16
|
end
|
@@ -59,9 +59,11 @@ module Qti
|
|
59
59
|
def stem_text
|
60
60
|
clean_stem_items.search('p').children.map do |stem_item|
|
61
61
|
if stem_item.name == 'gap'
|
62
|
+
blank_id = stem_item.attributes['identifier'].value
|
62
63
|
{
|
63
64
|
type: 'blank',
|
64
|
-
blank_id:
|
65
|
+
blank_id: blank_id,
|
66
|
+
blank_name: correct_choice_value(blank_id)
|
65
67
|
}
|
66
68
|
else
|
67
69
|
{
|
@@ -84,12 +86,15 @@ module Qti
|
|
84
86
|
end
|
85
87
|
end
|
86
88
|
|
89
|
+
def correct_choice_value(node_id)
|
90
|
+
answer_choice(choices, question_response_id_mapping[node_id]).content
|
91
|
+
end
|
92
|
+
|
87
93
|
def scoring_data_structs
|
88
|
-
mapping = question_response_id_mapping
|
89
94
|
answer_nodes.map do |value_node|
|
90
95
|
node_id = value_node.attributes['identifier']&.value
|
91
96
|
ScoringData.new(
|
92
|
-
|
97
|
+
correct_choice_value(node_id),
|
93
98
|
'directedPair',
|
94
99
|
id: node_id,
|
95
100
|
case: false
|
@@ -114,11 +119,13 @@ module Qti
|
|
114
119
|
end
|
115
120
|
|
116
121
|
def question_response_id_mapping
|
117
|
-
|
118
|
-
value.
|
122
|
+
@question_response_id_mapping ||= begin
|
123
|
+
question_response_pairs = node.xpath('.//xmlns:correctResponse//xmlns:value').map do |value|
|
124
|
+
value.content.split
|
125
|
+
end
|
126
|
+
question_response_pairs.map!(&:reverse)
|
127
|
+
Hash[question_response_pairs]
|
119
128
|
end
|
120
|
-
question_response_pairs.map!(&:reverse)
|
121
|
-
Hash[question_response_pairs]
|
122
129
|
end
|
123
130
|
end
|
124
131
|
end
|
data/lib/qti/version.rb
CHANGED
@@ -20,6 +20,10 @@ describe Qti::V2::Models::AssessmentItem do
|
|
20
20
|
expect(loaded_class.item_body).to include 'Look at the text in the picture.'
|
21
21
|
end
|
22
22
|
|
23
|
+
it 'includes the prompt in the item_body' do
|
24
|
+
expect(loaded_class.item_body).to include 'What does it say?'
|
25
|
+
end
|
26
|
+
|
23
27
|
it 'falls back onto nil points possible value' do
|
24
28
|
expect(loaded_class.points_possible).to eq nil
|
25
29
|
end
|
@@ -43,6 +47,19 @@ describe Qti::V2::Models::AssessmentItem do
|
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
50
|
+
context 'gap_match.xml' do
|
51
|
+
let(:fixtures_path) { File.join('spec', 'fixtures') }
|
52
|
+
let(:file_path) { File.join(fixtures_path, 'items_2.1', 'gap_match.xml') }
|
53
|
+
let(:loaded_class) { described_class.from_path!(file_path) }
|
54
|
+
|
55
|
+
it 'returns the prompt as the first stem item even after calculating item_body' do
|
56
|
+
loaded_class.item_body
|
57
|
+
stem_items = loaded_class.interaction_model.stem_items
|
58
|
+
expect(stem_items.count).to equal(12)
|
59
|
+
expect(stem_items.first[:value]).to include('Identify the missing words')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
46
63
|
context 'all test files' do
|
47
64
|
test_files = Dir.glob(File.join('spec', 'fixtures', 'items_2.1', '*.xml'))
|
48
65
|
test_files.each do |file|
|
@@ -11,11 +11,11 @@ describe Qti::V2::Models::Interactions::GapMatchInteraction do
|
|
11
11
|
value: "Identify the missing words in this famous quote from Shakespeare's Richard III.",
|
12
12
|
id: 'stem_0', position: 1 },
|
13
13
|
{ type: 'text', value: 'Now is the ', id: 'stem_1', position: 2 },
|
14
|
-
{ type: 'blank', blank_id: 'G1', id: 'stem_2', position: 3 },
|
14
|
+
{ type: 'blank', blank_id: 'G1', blank_name: 'winter', id: 'stem_2', position: 3 },
|
15
15
|
{ type: 'text', value: ' of our discontent', id: 'stem_3', position: 4 },
|
16
16
|
{ type: 'text', value: ' ', id: 'stem_4', position: 5 },
|
17
17
|
{ type: 'text', value: ' Made glorious ', id: 'stem_5', position: 6 },
|
18
|
-
{ type: 'blank', blank_id: 'G2', id: 'stem_6', position: 7 },
|
18
|
+
{ type: 'blank', blank_id: 'G2', blank_name: 'summer', id: 'stem_6', position: 7 },
|
19
19
|
{ type: 'text', value: ' by this sun of York;', id: 'stem_7', position: 8 },
|
20
20
|
{ type: 'text', value: ' ', id: 'stem_8', position: 9 },
|
21
21
|
{ type: 'text', value: " And all the clouds that lour'd\n upon our house",
|
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: 2.
|
4
|
+
version: 2.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Diaz
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2023-01-31 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: actionview
|
@@ -148,16 +148,16 @@ dependencies:
|
|
148
148
|
name: sanitize
|
149
149
|
requirement: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- - "
|
151
|
+
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version: '5.
|
153
|
+
version: '5.3'
|
154
154
|
type: :runtime
|
155
155
|
prerelease: false
|
156
156
|
version_requirements: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
|
-
- - "
|
158
|
+
- - ">="
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version: '5.
|
160
|
+
version: '5.3'
|
161
161
|
- !ruby/object:Gem::Dependency
|
162
162
|
name: bundler
|
163
163
|
requirement: !ruby/object:Gem::Requirement
|