qti 2.26.1 → 2.27.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: d185ca9468c4d41b04a10ffc8fdddc3b443ecd632de1f5b64c68dde754da375e
4
- data.tar.gz: 5d47f324498c8c1d0bbb42eea2dbc08976aa7836c0cd6c386456f0e2bd5b86b5
3
+ metadata.gz: 5c3be9692650dc7d212b9bb3618b9926baebbad109aeadac7ddb4778c6be65e8
4
+ data.tar.gz: 3560522773a644fca6d88548c7494c6135858171a7c607fd4172b6d515c6b689
5
5
  SHA512:
6
- metadata.gz: c61f7ecb24c47c98892d9edf31f1d145d7f3acddd9fab59c22dc15d0559a3e1c531046f33bee05790aff8db27b1d785d38554ac15eb994025b2dc0713e8e2586
7
- data.tar.gz: e2fc18ee5e506a6db953868dd5e90e69e418f04054be671250c6fa55fa375cd8ba9954e7f3d90ec6f4b819abad673eef8344723671cd45b7c11d3e0972d4e50d
6
+ metadata.gz: 9cc42e6a26a221f71501e96493dd29c57c880cbf77bd41c90988d14182f2a22c03cc79dbc81e64f3489cbb141126d9e65ec907fff802baea8258181ecacc04e6
7
+ data.tar.gz: 7f434b423b05eab7c0bbafb9443fa083d4b0226a15425eaf49246b9388d45d61cf040b542a0308433c613f989a1f0ceed31ade37bcdb242a6fba406405ace82a
@@ -54,13 +54,30 @@ module Qti
54
54
  end
55
55
  end
56
56
 
57
+ def default_orientation
58
+ passage == 'true' ? 'top' : 'left'
59
+ end
60
+
57
61
  def orientation
58
62
  @orientation ||= begin
59
63
  presentation = @node.at_xpath('.//xmlns:presentation')
60
- return 'left' if presentation.blank?
61
- presentation.at_xpath('.//xmlns:material')&.attributes&.[]('orientation')&.value || 'left'
64
+ return default_orientation if presentation.blank?
65
+
66
+ orientation_value = presentation.at_xpath('.//xmlns:material')&.attributes&.[]('orientation')&.value
67
+ orientation_value.presence || default_orientation
62
68
  end
63
69
  end
70
+
71
+ def passage_qti_metadata?
72
+ qti_metadata_children.children.any? { |node| node.text == 'passage' }
73
+ end
74
+
75
+ def passage
76
+ return false unless passage_qti_metadata?
77
+
78
+ passage_label = qti_metadata_children.children.find { |node| node.text == 'passage' }
79
+ passage_label&.next&.text.presence || false
80
+ end
64
81
  end
65
82
  end
66
83
  end
@@ -37,6 +37,10 @@ module Qti
37
37
  def orientation
38
38
  'left'
39
39
  end
40
+
41
+ def passage
42
+ false
43
+ end
40
44
  end
41
45
  end
42
46
  end
data/lib/qti/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qti
2
- VERSION = '2.26.1'.freeze
2
+ VERSION = '2.27.0'.freeze
3
3
  end
@@ -31,6 +31,10 @@
31
31
  <fieldlabel>source_url</fieldlabel>
32
32
  <fieldentry>https://sourceurl.com</fieldentry>
33
33
  </qtimetadatafield>
34
+ <qtimetadatafield>
35
+ <fieldlabel>passage</fieldlabel>
36
+ <fieldentry>false</fieldentry>
37
+ </qtimetadatafield>
34
38
  </qtimetadata>
35
39
  </itemmetadata>
36
40
  <presentation>
@@ -0,0 +1,48 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
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 ident="i1e5e0d6fba7342e63ae43afe9863070d" title="Quiz.text">
4
+ <qtimetadata>
5
+ <qtimetadatafield>
6
+ <fieldlabel>cc_maxattempts</fieldlabel>
7
+ <fieldentry>1</fieldentry>
8
+ </qtimetadatafield>
9
+ </qtimetadata>
10
+ <section ident="root_section">
11
+ <item ident="d74b47a4abeeed159e030bfecbcecea2" title="some title" instructions="some instructions">
12
+ <itemmetadata>
13
+ <qtimetadata>
14
+ <qtimetadatafield>
15
+ <fieldlabel>question_type</fieldlabel>
16
+ <fieldentry>text_only_question</fieldentry>
17
+ </qtimetadatafield>
18
+ <qtimetadatafield>
19
+ <fieldlabel>points_possible</fieldlabel>
20
+ <fieldentry>0.0</fieldentry>
21
+ </qtimetadatafield>
22
+ <qtimetadatafield>
23
+ <fieldlabel>original_answer_ids</fieldlabel>
24
+ <fieldentry/>
25
+ </qtimetadatafield>
26
+ <qtimetadatafield>
27
+ <fieldlabel>assessment_question_identifierref</fieldlabel>
28
+ <fieldentry>9f47365e112840d80a79a960b1b0b6a7</fieldentry>
29
+ </qtimetadatafield>
30
+ <qtimetadatafield>
31
+ <fieldlabel>source_url</fieldlabel>
32
+ <fieldentry>https://sourceurl.com</fieldentry>
33
+ </qtimetadatafield>
34
+ <qtimetadatafield>
35
+ <fieldlabel>passage</fieldlabel>
36
+ <fieldentry>true</fieldentry>
37
+ </qtimetadatafield>
38
+ </qtimetadata>
39
+ </itemmetadata>
40
+ <presentation>
41
+ <material orientation="top">
42
+ <mattext texttype="text/html">&lt;p&gt;passage content&lt;/p&gt;</mattext>
43
+ </material>
44
+ </presentation>
45
+ </item>
46
+ </section>
47
+ </assessment>
48
+ </questestinterop>
@@ -59,7 +59,24 @@ describe Qti::V1::Models::StimulusItem do
59
59
  {
60
60
  source_url: 'https://sourceurl.com',
61
61
  instructions: 'some instructions',
62
- orientation: 'top'
62
+ orientation: 'top',
63
+ passage: 'false'
64
+ }.each do |key, value|
65
+ it "returns the correct #{key}" do
66
+ expect(stimulus_item.send(key)).to eq(value)
67
+ end
68
+ end
69
+ end
70
+
71
+ context 'when the passage item was generated by New Quizzes' do
72
+ let(:file_path) { File.join('spec', 'fixtures', 'items_1.2', 'stimulus_passage.xml') }
73
+ let(:test_object) { Qti::V1::Models::Assessment.from_path!(file_path) }
74
+ let(:stimulus_item) { test_object.create_stimulus(test_object.assessment_items.first) }
75
+ {
76
+ source_url: 'https://sourceurl.com',
77
+ instructions: 'some instructions',
78
+ orientation: 'top',
79
+ passage: 'true'
63
80
  }.each do |key, value|
64
81
  it "returns the correct #{key}" do
65
82
  expect(stimulus_item.send(key)).to eq(value)
@@ -75,7 +92,8 @@ describe Qti::V1::Models::StimulusItem do
75
92
  {
76
93
  source_url: nil,
77
94
  instructions: nil,
78
- orientation: 'left'
95
+ orientation: 'left',
96
+ passage: false
79
97
  }.each do |key, value|
80
98
  it "returns the correct #{key}" do
81
99
  expect(stimulus_item.send(key)).to eq(value)
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.26.1
4
+ version: 2.27.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: 2025-03-31 00:00:00.000000000 Z
15
+ date: 2025-04-03 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: actionview
@@ -423,6 +423,7 @@ files:
423
423
  - spec/fixtures/items_1.2/question_group.xml
424
424
  - spec/fixtures/items_1.2/single_fib.xml
425
425
  - spec/fixtures/items_1.2/stimulus.xml
426
+ - spec/fixtures/items_1.2/stimulus_passage.xml
426
427
  - spec/fixtures/items_1.2/stimulus_with_child_item.xml
427
428
  - spec/fixtures/items_1.2/text.no.question.xml
428
429
  - spec/fixtures/items_1.2/true_false.xml
@@ -806,6 +807,7 @@ test_files:
806
807
  - spec/fixtures/items_1.2/question_group.xml
807
808
  - spec/fixtures/items_1.2/single_fib.xml
808
809
  - spec/fixtures/items_1.2/stimulus.xml
810
+ - spec/fixtures/items_1.2/stimulus_passage.xml
809
811
  - spec/fixtures/items_1.2/stimulus_with_child_item.xml
810
812
  - spec/fixtures/items_1.2/text.no.question.xml
811
813
  - spec/fixtures/items_1.2/true_false.xml