qti 2.22.5 → 2.23.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30052eb8b376ccde4e42a859c75d817c7844a066d008afe70884456fbb88c432
4
- data.tar.gz: 7daaa441ebfd637728d44dd255f9aefd2e89e306f9e1966c8ee4ff35aabcbdd5
3
+ metadata.gz: e31df9f591cac79f5ac4c2d6ac0901757151e68532ee60cd94599bfd028fd114
4
+ data.tar.gz: 29eebbef83f5cbd6e08ba3e556e2fb390995f3794a218d7529c1b27e7b6b2c99
5
5
  SHA512:
6
- metadata.gz: dbc8366473d50ef8dcbe8e823ac93077af426107e72f8bf03257f4037f9a5baeefac737c1fd4c4976f81aaa155a76b9833e132c07f1c0f8b4d55cd3123a3981b
7
- data.tar.gz: b2f8606881c6481a16404f885fbd920e1372b6534c4dcd94142d8a34803145c74926b3e0f7841c2ad7e05face6bb64ed76e634ae64141dddd6ebab737f448324
6
+ metadata.gz: '0983e7070edb2d6d6bea9efa4fa7e3daff11a77fdddb9230a13dc71fa7191ca69deba037443fb8a57fb6737c5e609ab383568d07d89f39c1907aa779c2505faa'
7
+ data.tar.gz: d3e1041c1ff761a9db545fbe0bca3170d6247cbcb73070c42160c5444e095a7d3f9453bf4da2a9c60ffdeb71fc6f755ce5af7cec4aa4857c551fe78ea0b38ee3
@@ -14,6 +14,10 @@ module Qti
14
14
  @title ||= xpath_with_single_check('.//xmlns:assessment/@title')&.content || File.basename(@path, '.xml')
15
15
  end
16
16
 
17
+ def external_assignment_id
18
+ @external_assignment_id ||= xpath_with_single_check('.//xmlns:assessment/@external_assignment_id')&.content
19
+ end
20
+
17
21
  def assessment_items
18
22
  @doc.xpath("//*[self::#{GROUP_ID} or self::xmlns:item[not(ancestor::#{GROUP_ID})]" \
19
23
  ' or self::xmlns:bankentry_item]')
@@ -2,6 +2,7 @@ module Qti
2
2
  module V1
3
3
  module Models
4
4
  module Interactions
5
+ # This is the Interaction for Essay question type
5
6
  class StringInteraction < BaseInteraction
6
7
  # This will know if a class matches
7
8
  def self.matches(node, parent)
@@ -35,6 +36,10 @@ module Qti
35
36
  @word_limit_min ||= @node.at_xpath('.//xmlns:response_str/@word_limit_min')&.value
36
37
  end
37
38
 
39
+ def scoring_data_structs
40
+ { value: grading_notes }
41
+ end
42
+
38
43
  private
39
44
 
40
45
  def rcardinality
@@ -44,6 +49,12 @@ module Qti
44
49
  def rce_raw
45
50
  @rce_raw ||= @node.at_xpath('.//xmlns:response_str/@rce')&.value
46
51
  end
52
+
53
+ def grading_notes
54
+ path = './/xmlns:qtimetadatafield/xmlns:fieldlabel' \
55
+ '[text()="grading_notes"]/../xmlns:fieldentry'
56
+ @grading_notes ||= @node.at_xpath(path)&.text || ''
57
+ end
47
58
  end
48
59
  end
49
60
  end
@@ -13,6 +13,10 @@ module Qti
13
13
  @identifier ||= xpath_with_single_check('.//xmlns:objectbank/@ident')&.content
14
14
  end
15
15
 
16
+ def canvas_item_bank
17
+ @canvas_item_bank ||= xpath_with_single_check('.//xmlns:objectbank/@canvas_item_bank')&.content
18
+ end
19
+
16
20
  # tells us whether the bank was an account or course bank
17
21
  def bank_type
18
22
  @bank_type ||= xpath_with_single_check(
@@ -13,6 +13,10 @@ module Qti
13
13
  @title ||= xpath_with_single_check('//xmlns:assessmentTest/@title')&.content || File.basename(@path, '.xml')
14
14
  end
15
15
 
16
+ def external_assignment_id
17
+ nil
18
+ end
19
+
16
20
  def assessment_items
17
21
  # Return the xml files we should be parsing
18
22
  @assessment_items ||= begin
data/lib/qti/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qti
2
- VERSION = '2.22.5'.freeze
2
+ VERSION = '2.23.0'.freeze
3
3
  end
@@ -1,6 +1,14 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <questestinterop xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/xsd/ims_qtiasiv1p2p1.xsd">
3
3
  <item ident="if15fb877c2cde9a14437aa7429360ac6" title="First Essay">
4
+ <itemmetadata>
5
+ <qtimetadata>
6
+ <qtimetadatafield>
7
+ <fieldlabel>grading_notes</fieldlabel>
8
+ <fieldentry>this is the remix</fieldentry>
9
+ </qtimetadatafield>
10
+ </qtimetadata>
11
+ </itemmetadata>
4
12
  <presentation>
5
13
  <material>
6
14
  <mattext texttype="text/html">
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="ISO-8859-1"?>
2
2
  <questestinterop xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/xsd/ims_qtiasiv1p2p1.xsd">
3
- <assessment title="1.2 Import Quiz" ident="A1001">
3
+ <assessment title="1.2 Import Quiz" ident="A1001" external_assignment_id="801785">
4
4
  <section title="Main" ident="S1002">
5
5
  <item title="Grading - specific - 3 pt score" ident="QUE_1003">
6
6
  <presentation>
@@ -25,6 +25,12 @@ describe Qti::V1::Models::Assessment do
25
25
  expect(loaded_class.identifier).to eq(expected_identifier)
26
26
  end
27
27
  end
28
+
29
+ describe '#external_assignment_id' do
30
+ it 'retruns the external_assignment_id' do
31
+ expect(loaded_class.external_assignment_id).to eq(expected_external_assignment_id)
32
+ end
33
+ end
28
34
  end
29
35
 
30
36
  shared_examples_for 'verify quiz items' do
@@ -43,6 +49,7 @@ describe Qti::V1::Models::Assessment do
43
49
  let(:loaded_class) { described_class.from_path!(path) }
44
50
  let(:expected_title) { '1.2 Import Quiz' }
45
51
  let(:expected_identifier) { 'A1001' }
52
+ let(:expected_external_assignment_id) { '801785' }
46
53
  let(:expected_item_count) { 5 }
47
54
 
48
55
  include_examples('basic quiz fields')
@@ -52,6 +59,7 @@ describe Qti::V1::Models::Assessment do
52
59
  let(:path) { File.join(fixtures_path, 'feedback_quiz_1.2.xml') }
53
60
  let(:loaded_class) { described_class.from_path!(path) }
54
61
  let(:expected_title) { 'I Can Haz Feedback' }
62
+ let(:expected_external_assignment_id) { nil }
55
63
  let(:expected_identifier) { 'i618e88580f76f70a1ed28804f497df9c' }
56
64
  let(:expected_item_count) { 3 }
57
65
  let(:expected_item_data) do
@@ -82,6 +90,7 @@ describe Qti::V1::Models::Assessment do
82
90
  let(:path) { File.join(fixtures_path, 'all_canvas_simple_1.2.xml') }
83
91
  let(:loaded_class) { described_class.from_path!(path) }
84
92
  let(:expected_title) { 'Every Canvas Interaction' }
93
+ let(:expected_external_assignment_id) { nil }
85
94
  let(:expected_identifier) { 'ie09bc528e6ecd1cb9ebfafd940c20215' }
86
95
  let(:expected_item_count) { 10 }
87
96
  let(:expected_item_data) do
@@ -19,6 +19,10 @@ describe Qti::V1::Models::Interactions::StringInteraction do
19
19
  expect(loaded_class.word_limit_max).to be_nil
20
20
  expect(loaded_class.word_limit_min).to be_nil
21
21
  end
22
+
23
+ it 'does not return any grading notes' do
24
+ expect(loaded_class.scoring_data_structs).to eq({ value: '' })
25
+ end
22
26
  end
23
27
 
24
28
  context 'essay.xml question with custom settings' do
@@ -31,5 +35,9 @@ describe Qti::V1::Models::Interactions::StringInteraction do
31
35
  expect(loaded_class.word_limit_max).to eq('500')
32
36
  expect(loaded_class.word_limit_min).to eq('140')
33
37
  end
38
+
39
+ it 'has grading notes' do
40
+ expect(loaded_class.scoring_data_structs).to eq({ value: 'this is the remix' })
41
+ end
34
42
  end
35
43
  end
@@ -3,7 +3,7 @@ describe Qti::V1::Models::ObjectBank do
3
3
  <<~XML
4
4
  <?xml version="1.0" encoding="UTF-8"?>
5
5
  <questestinterop xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/xsd/ims_qtiasiv1p2p1.xsd">
6
- <objectbank ident="gooblegobble12345">
6
+ <objectbank ident="gooblegobble12345" canvas_item_bank="true">
7
7
  <qtimetadata>
8
8
  <qtimetadatafield>
9
9
  <fieldlabel>not_a_bank_title</fieldlabel>
@@ -57,6 +57,14 @@ describe Qti::V1::Models::ObjectBank do
57
57
  end
58
58
  end
59
59
 
60
+ describe '#canvas_item_bank' do
61
+ it 'returns the canvas_item_bank' do
62
+ allow(File).to receive(:read).and_return(doc)
63
+ objectbank = described_class.new path: '/etc/FakeBank008.xml'
64
+ expect(objectbank.canvas_item_bank).to eq 'true'
65
+ end
66
+ end
67
+
60
68
  describe '#bank_type' do
61
69
  it 'has the bank_type attribute' do
62
70
  allow(File).to receive(:read).and_return(doc)
@@ -19,6 +19,10 @@ describe Qti::V2::Models::AssessmentTest do
19
19
  expect(loaded_class.identifier).to eq 'SPECTATUS-GENERATED-TEST'
20
20
  end
21
21
 
22
+ it 'has a nil external_assignment_id' do
23
+ expect(loaded_class.external_assignment_id).to be_nil
24
+ end
25
+
22
26
  it 'gets dependency file refs' do
23
27
  refs = loaded_class.assessment_items
24
28
  expect(refs.all? { |ref| File.extname(ref[:path]) == '.xml' })
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.22.5
4
+ version: 2.23.0
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: 2023-10-13 00:00:00.000000000 Z
15
+ date: 2024-05-23 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: actionview