qti 2.6.0 → 2.6.2

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: cb32e14ee86e7c85cf22b461d411e17321ebe7a96c5727fd78df4f70adee12f0
4
- data.tar.gz: 40d79b54aa1c73109512a9b40761ca2d9af1e71bfddca3881d4a8bd921dad381
3
+ metadata.gz: 1efc6d4685a9ee4de6bd99f210c19cc58d192b62eb7a826625cd73c982d5d72f
4
+ data.tar.gz: 36be4ac43a818860c0d76f22f233d8ece3d27bb4d2add350535892452426da46
5
5
  SHA512:
6
- metadata.gz: 14938cdfe0af943580f0d6af4429b0942a57e8f2b6c5083a65efa49832b6b01fd063444ab5a7a5b51416f12603698d799e62f00cc1aacfb120580e2ca31cf7fd
7
- data.tar.gz: bce723b2da53fa956f2ae7b7f76d8ce6ae24fd253e991016ddfc049ff7c9618255e6e9979b0e0d233ff6176d1b2a4d65ae2744e36b108f59dab9e4be2db8892a
6
+ metadata.gz: eff97a9889ad795c323771b45358bd76561329ea12788813dbe833934354ba5c79e09fb5f1bbb0b02eb5b694d3ba8131af2ea20d8a426a624a38954daa13a29a
7
+ data.tar.gz: 7a9258aa3bf9c5707e15df8fe8d5e59e805e4545218f351464a181177b973cfba2808d9bcd8549ab046da08f7ce0c75fb5b42a9193f37e109bd5d05a6e6cdb2f
@@ -3,7 +3,7 @@ module Qti
3
3
  module Models
4
4
  module Interactions
5
5
  class BaseFillBlankInteraction < BaseInteraction
6
- CANVAS_REGEX ||= /(\[.+?\])/.freeze
6
+ CANVAS_REGEX ||= /(\[[A-Za-z0-9_\-.]+\])/.freeze
7
7
 
8
8
  def canvas_stem_items(item_prompt)
9
9
  item_prompt.split(CANVAS_REGEX).map.with_index do |stem_item, index|
@@ -12,6 +12,13 @@ module Qti
12
12
  def identifier
13
13
  @identifier ||= xpath_with_single_check('.//xmlns:objectbank/@ident')&.content
14
14
  end
15
+
16
+ # tells us whether the bank was an account or course bank
17
+ def bank_type
18
+ @bank_type ||= xpath_with_single_check(
19
+ './/xmlns:qtimetadatafield/xmlns:fieldlabel[text()="bank_type"]/../xmlns:fieldentry'
20
+ )&.content
21
+ end
15
22
  end
16
23
  end
17
24
  end
@@ -34,6 +34,10 @@ module Qti
34
34
  selection&.xpath('xmlns:selection_number')&.text&.to_i
35
35
  end
36
36
 
37
+ def sourcebank_ref
38
+ selection&.xpath('xmlns:sourcebank_ref')&.text
39
+ end
40
+
37
41
  def points_per_item
38
42
  selection.xpath('xmlns:selection_extension/xmlns:points_per_item')&.text&.to_f
39
43
  end
data/lib/qti/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qti
2
- VERSION = '2.6.0'.freeze
2
+ VERSION = '2.6.2'.freeze
3
3
  end
@@ -15,6 +15,7 @@
15
15
  <selection_extension>
16
16
  <points_per_item>1.0</points_per_item>
17
17
  </selection_extension>
18
+ <sourcebank_ref>sourcebank_reference_uuid</sourcebank_ref>
18
19
  </selection>
19
20
  </selection_ordering>
20
21
  <item ident="i09d4a5492a38a5b4d1533b8fdbdf7376" title="Question">
@@ -10,6 +10,31 @@ describe Qti::V1::Models::Interactions::BaseFillBlankInteraction do
10
10
  end
11
11
  end
12
12
 
13
+ context 'canvas_stem_items' do
14
+ let(:file_path) { File.join(fixtures_path, 'canvas_multiple_fib_as_single.xml') }
15
+ let(:simple_prompt) { 'fill in the [blank]' }
16
+ let(:simple_expected) do
17
+ [
18
+ { id: 'stem_0', position: 1, type: 'text', value: 'fill in the ' },
19
+ { id: 'stem_1', position: 2, type: 'text', value: '[blank]' }
20
+ ]
21
+ end
22
+ let(:embedded_prompt) { '[[embedded] [groups]]' }
23
+ let(:embedded_expected) do
24
+ [
25
+ { id: 'stem_0', position: 1, type: 'text', value: '[' },
26
+ { id: 'stem_1', position: 2, type: 'text', value: '[embedded]' },
27
+ { id: 'stem_2', position: 3, type: 'text', value: ' ' },
28
+ { id: 'stem_3', position: 4, type: 'text', value: '[groups]' },
29
+ { id: 'stem_4', position: 5, type: 'text', value: ']' }
30
+ ]
31
+ end
32
+ it 'decomposes item prompts' do
33
+ expect(loaded_class.canvas_stem_items(simple_prompt)).to eq(simple_expected)
34
+ expect(loaded_class.canvas_stem_items(embedded_prompt)).to eq(embedded_expected)
35
+ end
36
+ end
37
+
13
38
  context 'canvas_multiple_dropdowns.xml' do
14
39
  let(:file_path) { File.join(fixtures_path, 'canvas_multiple_dropdowns.xml') }
15
40
  let(:expected_blanks) do
@@ -9,6 +9,10 @@ describe Qti::V1::Models::ObjectBank do
9
9
  <fieldlabel>not_a_bank_title</fieldlabel>
10
10
  <fieldentry>A different metadata entry</fieldentry>
11
11
  </qtimetadatafield>
12
+ <qtimetadatafield>
13
+ <fieldlabel>bank_type</fieldlabel>
14
+ <fieldentry>account</fieldentry>
15
+ </qtimetadatafield>
12
16
  </qtimetadata>
13
17
  </objectbank>
14
18
  </questestinterop>
@@ -48,4 +52,12 @@ describe Qti::V1::Models::ObjectBank do
48
52
  expect(objectbank.identifier).to eq 'gooblegobble12345'
49
53
  end
50
54
  end
55
+
56
+ describe '#bank_type' do
57
+ it 'has the bank_type attribute' do
58
+ allow(File).to receive(:read).and_return(doc)
59
+ objectbank = described_class.new path: '/etc/FakeBank008.xml'
60
+ expect(objectbank.bank_type).to eq 'account'
61
+ end
62
+ end
51
63
  end
@@ -7,6 +7,7 @@ describe Qti::V1::Models::QuestionGroup do
7
7
  it 'configures a group correctly' do
8
8
  expect(loaded_class.title).to eq('Group 1 (1/4)')
9
9
  expect(loaded_class.identifier).to eq('i4663897607358cfba8636ed6127b9466')
10
+ expect(loaded_class.sourcebank_ref).to eq('sourcebank_reference_uuid')
10
11
  expect(loaded_class.items.count).to eq(4)
11
12
  expect(loaded_class.selection_number).to eq(1)
12
13
  expect(loaded_class.points_per_item).to eq(1)
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.6.0
4
+ version: 2.6.2
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: 2021-10-12 00:00:00.000000000 Z
12
+ date: 2021-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview