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 +4 -4
- data/lib/qti/v1/models/stimulus_item.rb +19 -2
- data/lib/qti/v2/models/stimulus_item.rb +4 -0
- data/lib/qti/version.rb +1 -1
- data/spec/fixtures/items_1.2/stimulus.xml +4 -0
- data/spec/fixtures/items_1.2/stimulus_passage.xml +48 -0
- data/spec/lib/qti/v1/models/stimulus_item_spec.rb +20 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c3be9692650dc7d212b9bb3618b9926baebbad109aeadac7ddb4778c6be65e8
|
4
|
+
data.tar.gz: 3560522773a644fca6d88548c7494c6135858171a7c607fd4172b6d515c6b689
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
61
|
-
|
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
|
data/lib/qti/version.rb
CHANGED
@@ -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"><p>passage content</p></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.
|
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
|
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
|