qti 2.8.1 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54df1ca504a8dea01a48ad17e4e8e106fb44b85d45c32e2755713ac635314144
4
- data.tar.gz: a464fc49887753cfc9d73679439d5f81ead4cbd9c6fa66d67e0b319f7dafa3fd
3
+ metadata.gz: 795e15592723e240bf42bb23030ae237606cdb9c4191ce010bf241ae1d23d6f7
4
+ data.tar.gz: ce7a0e634699b57c08ce425d247b928405b36de2dc98f34435dbf6e84e7e4551
5
5
  SHA512:
6
- metadata.gz: 826397ae8d2beca0fc36f2baa4e85329728c628809aa60863abeca662e4b2238a8724823a50758835e72ecf3bee05848758e128af38a5cded27e5c07e0281535
7
- data.tar.gz: 1180b3f0f9725d2cc6888a528a584d3b0e436bfef6885c0a7216a3cede6b4123b21c7529dd45d69c543d8e44eeb442e5ae8557a913e0caa53cad86cfe65e33d6
6
+ metadata.gz: 2699fb585fa48d0ee298426ae9ecca58724f5298cc3422e0d5363acbffae04bc3e58502bd72e7cc7433571975cb0152c81887d743412678c4a79bc691dfde2e0
7
+ data.tar.gz: 8b6bd0ac53d3c5783c7ebdea6d2cabe238b37ccb0365ae8ef045207a1d9d1493ebc48f4ae13371a4ecb872ca67fdbc8d9232e45c156e6c83e70b10fa311161db
@@ -9,7 +9,7 @@ module Qti
9
9
  item_prompt.split(CANVAS_REGEX).map.with_index do |stem_item, index|
10
10
  if canvas_fib_response_ids.include?(stem_item)
11
11
  # Strip the brackets before searching
12
- stem_blank(index, canvas_blank_id(stem_item[1..-2]))
12
+ stem_blank(index, stem_item[1..-2])
13
13
  else
14
14
  stem_text(index, stem_item)
15
15
  end
@@ -21,7 +21,8 @@ module Qti
21
21
  id: "stem_#{index}",
22
22
  position: index + 1,
23
23
  type: 'blank',
24
- blank_id: value
24
+ blank_id: blank_id(value),
25
+ blank_name: value
25
26
  }
26
27
  end
27
28
 
@@ -34,6 +35,15 @@ module Qti
34
35
  }
35
36
  end
36
37
 
38
+ def blank_id(stem_item)
39
+ return stem_item unless canvas_custom_fitb?
40
+ canvas_blank_id(stem_item)
41
+ end
42
+
43
+ def canvas_custom_fitb?
44
+ @canvas_custom_fitb ||= BaseInteraction.canvas_custom_fitb?(@node)
45
+ end
46
+
37
47
  def canvas_blank_id(stem_item)
38
48
  blank_id = nil
39
49
  node.xpath('.//xmlns:response_lid/xmlns:material').children.map do |response_lid_node|
@@ -9,6 +9,11 @@ module Qti
9
9
  false
10
10
  end
11
11
 
12
+ def self.canvas_custom_fitb?(node)
13
+ qtype = question_type(node)
14
+ %w[fill_in_multiple_blanks_question multiple_dropdowns_question].include? qtype
15
+ end
16
+
12
17
  def self.canvas_multiple_fib?(node)
13
18
  matches = node.xpath('.//xmlns:response_lid')
14
19
  return false if matches.count < 1
data/lib/qti/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qti
2
- VERSION = '2.8.1'.freeze
2
+ VERSION = '2.9.0'.freeze
3
3
  end
@@ -44,9 +44,9 @@ describe Qti::V1::Models::Interactions::CanvasMultipleDropdownInteraction do
44
44
  let(:expected_stem_items) do
45
45
  [
46
46
  { id: 'stem_0', position: 1, type: 'text', value: '<div><p>Roses are ' },
47
- { id: 'stem_1', position: 2, type: 'blank', blank_id: 'response_color1' },
47
+ { id: 'stem_1', position: 2, type: 'blank', blank_id: 'response_color1', blank_name: 'color1' },
48
48
  { id: 'stem_2', position: 3, type: 'text', value: ', violets are ' },
49
- { id: 'stem_3', position: 4, type: 'blank', blank_id: 'response_color2' },
49
+ { id: 'stem_3', position: 4, type: 'blank', blank_id: 'response_color2', blank_name: 'color2' },
50
50
  { id: 'stem_4', position: 5, type: 'text', value: '.</p></div>' }
51
51
  ]
52
52
  end
@@ -47,7 +47,7 @@ describe Qti::V1::Models::Interactions::FillBlankInteraction do
47
47
  let(:expected_stem_items) do
48
48
  [
49
49
  { id: 'stem_0', position: 1, type: 'text', value: '<div><p>Chicago is in what state?</p></div>' },
50
- { id: 'stem_1', position: 2, type: 'blank', blank_id: 'response1' }
50
+ { id: 'stem_1', position: 2, type: 'blank', blank_id: 'response1', blank_name: 'response1' }
51
51
  ]
52
52
  end
53
53
 
@@ -72,9 +72,9 @@ describe Qti::V1::Models::Interactions::FillBlankInteraction do
72
72
  let(:expected_stem_items) do
73
73
  [
74
74
  { id: 'stem_0', position: 1, type: 'text', value: '<div><p><span>Roses are ' },
75
- { id: 'stem_1', position: 2, type: 'blank', blank_id: 'response_color1' },
75
+ { id: 'stem_1', position: 2, type: 'blank', blank_id: 'response_color1', blank_name: 'color1' },
76
76
  { id: 'stem_2', position: 3, type: 'text', value: ', violets are ' },
77
- { id: 'stem_3', position: 4, type: 'blank', blank_id: 'response_color2' },
77
+ { id: 'stem_3', position: 4, type: 'blank', blank_id: 'response_color2', blank_name: 'color2' },
78
78
  { id: 'stem_4', position: 5, type: 'text', value: '</span></p></div>' }
79
79
  ]
80
80
  end
@@ -102,11 +102,11 @@ describe Qti::V1::Models::Interactions::FillBlankInteraction do
102
102
  [
103
103
  { id: 'stem_0', position: 1, type: 'text', value: 'Fill-in-the blanks in this text from Richard III: ' },
104
104
  { id: 'stem_1', position: 2, type: 'text', value: 'Now is the ' },
105
- { id: 'stem_2', position: 3, type: 'blank', blank_id: 'FIB01' },
105
+ { id: 'stem_2', position: 3, type: 'blank', blank_id: 'FIB01', blank_name: 'FIB01' },
106
106
  { id: 'stem_3', position: 4, type: 'text', value: ' of our discontent made glorious ' },
107
- { id: 'stem_4', position: 5, type: 'blank', blank_id: 'FIB02' },
107
+ { id: 'stem_4', position: 5, type: 'blank', blank_id: 'FIB02', blank_name: 'FIB02' },
108
108
  { id: 'stem_5', position: 6, type: 'text', value: ' by these sons of ' },
109
- { id: 'stem_6', position: 7, type: 'blank', blank_id: 'FIB03' }
109
+ { id: 'stem_6', position: 7, type: 'blank', blank_id: 'FIB03', blank_name: 'FIB03' }
110
110
  ]
111
111
  end
112
112
 
@@ -165,11 +165,11 @@ describe Qti::V1::Models::Interactions::FillBlankInteraction do
165
165
  [
166
166
  { id: 'stem_0', position: 1, type: 'text', value: 'Fill-in-the blanks in this text from Richard III: ' },
167
167
  { id: 'stem_1', position: 2, type: 'text', value: 'Now is the ' },
168
- { id: 'stem_2', position: 3, type: 'blank', blank_id: 'FIB01' },
168
+ { id: 'stem_2', position: 3, type: 'blank', blank_id: 'FIB01', blank_name: 'FIB01' },
169
169
  { id: 'stem_3', position: 4, type: 'text', value: ' of our discontent made glorious ' },
170
- { id: 'stem_4', position: 5, type: 'blank', blank_id: 'FIB02' },
170
+ { id: 'stem_4', position: 5, type: 'blank', blank_id: 'FIB02', blank_name: 'FIB02' },
171
171
  { id: 'stem_5', position: 6, type: 'text', value: ' by these sons of ' },
172
- { id: 'stem_6', position: 7, type: 'blank', blank_id: 'FIB03' }
172
+ { id: 'stem_6', position: 7, type: 'blank', blank_id: 'FIB03', blank_name: 'FIB03' }
173
173
  ]
174
174
  end
175
175
 
@@ -195,7 +195,7 @@ describe Qti::V1::Models::Interactions::FillBlankInteraction do
195
195
  let(:expected_stem_items) do
196
196
  [
197
197
  { id: 'stem_0', position: 1, type: 'text', value: '<div><p>Bird, bird, bird, bird is the ' },
198
- { id: 'stem_1', position: 2, type: 'blank', blank_id: 'response_word' },
198
+ { id: 'stem_1', position: 2, type: 'blank', blank_id: 'response_word', blank_name: 'word' },
199
199
  { id: 'stem_2', position: 3, type: 'text', value: '</p></div>' }
200
200
  ]
201
201
  end
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.8.1
4
+ version: 2.9.0
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: 2022-02-01 00:00:00.000000000 Z
12
+ date: 2022-03-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -699,7 +699,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
699
699
  - !ruby/object:Gem::Version
700
700
  version: '0'
701
701
  requirements: []
702
- rubygems_version: 3.1.4
702
+ rubygems_version: 3.0.3
703
703
  signing_key:
704
704
  specification_version: 4
705
705
  summary: QTI 1.2 and 2.1 import and export models