qti 0.6.3 → 0.6.4
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 892498baf474eb47e6613f48d773d5be9b948b25
|
4
|
+
data.tar.gz: e0ed5d5cbf41b0af1bab5127024a4d646ffe26f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f5e2babb2f18a5be292e6524afab2f3ebadc52923f3cb844dc5b65100834265d1a702ef6271aaf2774a7f39d1288e266a6682e3e278442ab60d980a3db28ac1
|
7
|
+
data.tar.gz: 034499c04afe47d6d0af9dd3b725770ba7d866aa7ef4e749c023ad831660e877353f496f617f9b1cda3f2baaed4e7f9ae1a0652e92f4e7f290f7ad2269110b4b
|
@@ -63,7 +63,9 @@ module Qti
|
|
63
63
|
{ 'xmlns' => 'http://www.imsglobal.org/xsd/imsqti_v2p2', 'xmlns:xi' => 'http://www.w3.org/2001/XInclude',
|
64
64
|
'xmlns:m' => 'http://www.w3.org/1998/Math/MathML', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
65
65
|
'xsi:schemaLocation' => 'http://www.imsglobal.org/xsd/imsqti_v2p2 ' \
|
66
|
-
'http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd'
|
66
|
+
'http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd',
|
67
|
+
'timeDependent' => 'false', 'identifier' => "Item-#{assessment_item.identifier}",
|
68
|
+
'title' => assessment_item.title }
|
67
69
|
end
|
68
70
|
end
|
69
71
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Qti
|
2
2
|
module ContentPackaging
|
3
3
|
class AssessmentTest < Dry::Struct
|
4
|
+
attribute :identifier, Types::Strict::String
|
4
5
|
attribute :title, Types::Strict::String
|
5
6
|
attribute :items, Types::Strict::Array.member(ContentPackaging::AssessmentItem)
|
6
7
|
attribute :outcome_declarations, Types::Strict::Array.member(ContentPackaging::OutcomeDeclaration)
|
data/lib/qti/exporter.rb
CHANGED
@@ -25,7 +25,7 @@ module Qti
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def file_timestamp
|
28
|
-
Time.now.utc.strftime('%Y%m%d%H%M%S')
|
28
|
+
Time.now.utc.strftime('%Y%m%d%H%M%S%L')
|
29
29
|
end
|
30
30
|
|
31
31
|
def create_assessment_xml
|
@@ -36,9 +36,9 @@ module Qti
|
|
36
36
|
|
37
37
|
def assessment_xml_string
|
38
38
|
Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
|
39
|
-
xml.assessmentTest(assesment_test_attributes
|
39
|
+
xml.assessmentTest(assesment_test_attributes) do
|
40
40
|
outcome_declarations(xml, assessment_test)
|
41
|
-
xml.testPart do
|
41
|
+
xml.testPart(identifier: 'Main', navigationMode: 'linear', submissionMode: 'individual') do
|
42
42
|
xml_assessment_section(xml)
|
43
43
|
end
|
44
44
|
end
|
@@ -70,6 +70,7 @@ module Qti
|
|
70
70
|
builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
|
71
71
|
xml.manifest(imsmanifest_attributes) do
|
72
72
|
manifest_metadata(xml)
|
73
|
+
xml.organizations
|
73
74
|
manifest_resources(xml)
|
74
75
|
end
|
75
76
|
end
|
@@ -87,29 +88,29 @@ module Qti
|
|
87
88
|
end
|
88
89
|
end
|
89
90
|
|
91
|
+
# rubocop:disable Metrics/AbcSize
|
90
92
|
def learning_object_metadata(xml)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
imsmd_ns.identifier do
|
96
|
-
imsmd_ns.entry 'FB-02'
|
93
|
+
xml['imsmd'].lom do
|
94
|
+
xml['imsmd'].general do
|
95
|
+
xml['imsmd'].identifier do
|
96
|
+
xml['imsmd'].entry 'FB-02'
|
97
97
|
end
|
98
|
-
|
99
|
-
|
98
|
+
xml['imsmd'].title do
|
99
|
+
xml['imsmd'].string(assessment_test.title, 'language' => 'en')
|
100
100
|
end
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
xml['imsmd'].language 'en'
|
102
|
+
xml['imsmd'].description do
|
103
|
+
xml['imsmd'].string('Instructure QTI package.' \
|
104
104
|
'Feedback XML used as an example of unprocessable entity', 'language' => 'en')
|
105
105
|
end
|
106
|
+
keywords(xml)
|
106
107
|
end
|
107
|
-
keywords(xml)
|
108
108
|
end
|
109
109
|
end
|
110
|
+
# rubocop:enable Metrics/AbcSize
|
110
111
|
|
111
112
|
def keywords(xml)
|
112
|
-
keywords = %w
|
113
|
+
keywords = %w[feedback modal test inline block]
|
113
114
|
keywords.each do |keyword|
|
114
115
|
xml['imsmd'].keyword do
|
115
116
|
xml['imsmd'].string(keyword, 'language' => 'en')
|
@@ -134,21 +135,25 @@ module Qti
|
|
134
135
|
end
|
135
136
|
end
|
136
137
|
|
137
|
-
def assesment_test_attributes
|
138
|
-
{ 'xmlns' => 'http://www.imsglobal.org/xsd/
|
138
|
+
def assesment_test_attributes
|
139
|
+
{ 'xmlns' => 'http://www.imsglobal.org/xsd/imsqti_v2p2p1', 'xmlns:xi' => 'http://www.w3.org/2001/XInclude',
|
139
140
|
'xmlns:m' => 'http://www.w3.org/1998/Math/MathML', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
140
141
|
'xsi:schemaLocation' => 'http://www.imsglobal.org/xsd/imsqti_v2p2 ' \
|
141
|
-
|
142
|
+
'http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd',
|
143
|
+
'title' => assessment_test.title }
|
142
144
|
end
|
143
145
|
|
144
146
|
def imsmanifest_attributes
|
145
|
-
{ 'xmlns' => 'http://www.imsglobal.org/xsd/imscp_v1p1',
|
146
|
-
'xmlns:
|
147
|
-
'
|
148
|
-
|
147
|
+
{ 'xmlns' => 'http://www.imsglobal.org/xsd/imscp_v1p1',
|
148
|
+
'xmlns:imsmd' => 'http://ltsc.ieee.org/xsd/LOM',
|
149
|
+
'xmlns:imsqti' => 'http://www.imsglobal.org/xsd/imsqti_v2p2',
|
150
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
151
|
+
'xsi:schemaLocation' => 'http://www.imsglobal.org/xsd/imsqti_v2p2 ' \
|
152
|
+
'http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd ' \
|
149
153
|
'http://ltsc.ieee.org/xsd/LOM http://www.imsglobal.org/xsd/imsmd_loose_v1p3p2.xsd' \
|
150
|
-
'http://www.imsglobal.org/xsd/
|
151
|
-
'http://www.imsglobal.org/xsd/qti/qtiv2p2/
|
154
|
+
'http://www.imsglobal.org/xsd/imscp_v1p1 ' \
|
155
|
+
'http://www.imsglobal.org/xsd/qti/qtiv2p2/qtiv2p2_imscpv1p2_v1p0.xsd',
|
156
|
+
'identifier' => assessment_test.identifier }
|
152
157
|
end
|
153
158
|
|
154
159
|
def compress_package
|
@@ -27,7 +27,7 @@ describe Qti::AssessmentItemExporter do
|
|
27
27
|
expect(exporter.exported_file_path).to have_file_content(
|
28
28
|
<<-XML.strip_heredoc
|
29
29
|
<?xml version="1.0" encoding="UTF-8"?>
|
30
|
-
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd">
|
30
|
+
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd" timeDependent="false" identifier="Item-1" title="Question 1">
|
31
31
|
<responseDeclaration identifier="RESPONSE" cardinality="single" baseType="identifier">
|
32
32
|
<correctResponse>
|
33
33
|
<value>true</value>
|
@@ -1,38 +1,40 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Qti::Exporter do
|
4
|
-
let(:assessment_test) do
|
5
|
-
Qti::ContentPackaging::AssessmentTest.new(
|
6
|
-
title: 'Example test',
|
7
|
-
items: [
|
8
|
-
Qti::ContentPackaging::AssessmentItem.new(
|
9
|
-
identifier: '0b8664be39cf69ef76402f3e41eb05', title: 'Question 1', response: 'true',
|
10
|
-
interaction: Qti::ContentPackaging::ChoiceInteraction.new(
|
11
|
-
prompt: 'Is 1+1 equals 2?', maxChoices: 1,
|
12
|
-
choices: [
|
13
|
-
Qti::ContentPackaging::SimpleChoice.new(
|
14
|
-
identifier: 'true', body: 'True'
|
15
|
-
),
|
16
|
-
Qti::ContentPackaging::SimpleChoice.new(
|
17
|
-
identifier: 'false', body: 'False'
|
18
|
-
)
|
19
|
-
]
|
20
|
-
)
|
21
|
-
)
|
22
|
-
],
|
23
|
-
outcome_declarations: [
|
24
|
-
Qti::ContentPackaging::OutcomeDeclaration.new(
|
25
|
-
identifier: 'TEST_total', baseType: 'float', cardinality: 'single', defaultValue: 0.0
|
26
|
-
),
|
27
|
-
Qti::ContentPackaging::OutcomeDeclaration.new(
|
28
|
-
identifier: 'S1', baseType: 'float', cardinality: 'single', defaultValue: 0.0
|
29
|
-
)
|
30
|
-
]
|
31
|
-
)
|
32
|
-
end
|
33
|
-
|
34
4
|
describe '#export' do
|
35
5
|
let(:dir) { Dir.mktmpdir }
|
6
|
+
let(:test_identifier) { SecureRandom.uuid }
|
7
|
+
let(:item_identifier) { SecureRandom.uuid }
|
8
|
+
let(:assessment_test) do
|
9
|
+
Qti::ContentPackaging::AssessmentTest.new(
|
10
|
+
identifier: test_identifier,
|
11
|
+
title: 'Example test',
|
12
|
+
items: [
|
13
|
+
Qti::ContentPackaging::AssessmentItem.new(
|
14
|
+
identifier: item_identifier, title: 'Question 1', response: 'true',
|
15
|
+
interaction: Qti::ContentPackaging::ChoiceInteraction.new(
|
16
|
+
prompt: 'Is 1+1 equals 2?', maxChoices: 1,
|
17
|
+
choices: [
|
18
|
+
Qti::ContentPackaging::SimpleChoice.new(
|
19
|
+
identifier: 'true', body: 'True'
|
20
|
+
),
|
21
|
+
Qti::ContentPackaging::SimpleChoice.new(
|
22
|
+
identifier: 'false', body: 'False'
|
23
|
+
)
|
24
|
+
]
|
25
|
+
)
|
26
|
+
)
|
27
|
+
],
|
28
|
+
outcome_declarations: [
|
29
|
+
Qti::ContentPackaging::OutcomeDeclaration.new(
|
30
|
+
identifier: 'TEST_total', baseType: 'float', cardinality: 'single', defaultValue: 0.0
|
31
|
+
),
|
32
|
+
Qti::ContentPackaging::OutcomeDeclaration.new(
|
33
|
+
identifier: 'S1', baseType: 'float', cardinality: 'single', defaultValue: 0.0
|
34
|
+
)
|
35
|
+
]
|
36
|
+
)
|
37
|
+
end
|
36
38
|
let(:exporter) { Qti::Exporter.new(assessment_test, package_root_path: dir) }
|
37
39
|
|
38
40
|
before do
|
@@ -42,6 +44,7 @@ describe Qti::Exporter do
|
|
42
44
|
context 'empty assessment' do
|
43
45
|
let(:assessment_test) do
|
44
46
|
Qti::ContentPackaging::AssessmentTest.new(
|
47
|
+
identifier: test_identifier,
|
45
48
|
title: 'Empty test',
|
46
49
|
items: [],
|
47
50
|
outcome_declarations: []
|
@@ -52,8 +55,8 @@ describe Qti::Exporter do
|
|
52
55
|
expect(exporter.exported_file_path).to have_zip_entry('assessment.xml').with_content(
|
53
56
|
<<-XML.strip_heredoc
|
54
57
|
<?xml version="1.0" encoding="UTF-8"?>
|
55
|
-
<assessmentTest xmlns="http://www.imsglobal.org/xsd/
|
56
|
-
<testPart/>
|
58
|
+
<assessmentTest xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2p1" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd" title="Empty test">
|
59
|
+
<testPart identifier="Main" navigationMode="linear" submissionMode="individual"/>
|
57
60
|
</assessmentTest>
|
58
61
|
XML
|
59
62
|
)
|
@@ -61,11 +64,11 @@ describe Qti::Exporter do
|
|
61
64
|
end
|
62
65
|
|
63
66
|
it 'generates the xml for an assessment with an item' do
|
64
|
-
expect(exporter.exported_file_path).to contain_zip_entry(
|
67
|
+
expect(exporter.exported_file_path).to contain_zip_entry("#{item_identifier}.xml")
|
65
68
|
expect(exporter.exported_file_path).to have_zip_entry('assessment.xml').with_content(
|
66
69
|
<<-XML.strip_heredoc
|
67
70
|
<?xml version="1.0" encoding="UTF-8"?>
|
68
|
-
<assessmentTest xmlns="http://www.imsglobal.org/xsd/
|
71
|
+
<assessmentTest xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2p1" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd" title="Example test">
|
69
72
|
<outcomeDeclaration baseType="float" cardinality="single" identifier="TEST_total">
|
70
73
|
<defaultValue>
|
71
74
|
<value>0</value>
|
@@ -76,9 +79,9 @@ describe Qti::Exporter do
|
|
76
79
|
<value>0</value>
|
77
80
|
</defaultValue>
|
78
81
|
</outcomeDeclaration>
|
79
|
-
<testPart>
|
82
|
+
<testPart identifier="Main" navigationMode="linear" submissionMode="individual">
|
80
83
|
<assessmentSection identifier="S1" visible="true" title="Section 1">
|
81
|
-
<assessmentItemRef identifier="
|
84
|
+
<assessmentItemRef identifier="#{item_identifier}" href="#{item_identifier}.xml"/>
|
82
85
|
</assessmentSection>
|
83
86
|
</testPart>
|
84
87
|
</assessmentTest>
|
@@ -90,44 +93,45 @@ describe Qti::Exporter do
|
|
90
93
|
expect(exporter.exported_file_path).to have_zip_entry('imsmanifest.xml').with_content(
|
91
94
|
<<-XML.strip_heredoc
|
92
95
|
<?xml version="1.0" encoding="UTF-8"?>
|
93
|
-
<manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns:imsmd="http://ltsc.ieee.org/xsd/LOM" xmlns:imsqti="http://www.imsglobal.org/xsd/imsqti_v2p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/
|
96
|
+
<manifest xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns:imsmd="http://ltsc.ieee.org/xsd/LOM" xmlns:imsqti="http://www.imsglobal.org/xsd/imsqti_v2p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd http://ltsc.ieee.org/xsd/LOM http://www.imsglobal.org/xsd/imsmd_loose_v1p3p2.xsdhttp://www.imsglobal.org/xsd/imscp_v1p1 http://www.imsglobal.org/xsd/qti/qtiv2p2/qtiv2p2_imscpv1p2_v1p0.xsd" identifier="#{test_identifier}">
|
94
97
|
<metadata>
|
95
98
|
<schema>QTIv2.2 Package</schema>
|
96
99
|
<schemaversion>1.0.0</schemaversion>
|
97
100
|
<imsmd:lom>
|
98
|
-
<general>
|
99
|
-
<identifier>
|
100
|
-
<entry>FB-02</entry>
|
101
|
-
</identifier>
|
102
|
-
<title>
|
103
|
-
<string language="en">Example test</string>
|
104
|
-
</title>
|
105
|
-
<language>en</language>
|
106
|
-
<description>
|
107
|
-
<string language="en">Instructure QTI package.Feedback XML used as an example of unprocessable entity</string>
|
108
|
-
</description>
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
</imsmd:
|
101
|
+
<imsmd:general>
|
102
|
+
<imsmd:identifier>
|
103
|
+
<imsmd:entry>FB-02</imsmd:entry>
|
104
|
+
</imsmd:identifier>
|
105
|
+
<imsmd:title>
|
106
|
+
<imsmd:string language="en">Example test</imsmd:string>
|
107
|
+
</imsmd:title>
|
108
|
+
<imsmd:language>en</imsmd:language>
|
109
|
+
<imsmd:description>
|
110
|
+
<imsmd:string language="en">Instructure QTI package.Feedback XML used as an example of unprocessable entity</imsmd:string>
|
111
|
+
</imsmd:description>
|
112
|
+
<imsmd:keyword>
|
113
|
+
<imsmd:string language="en">feedback</imsmd:string>
|
114
|
+
</imsmd:keyword>
|
115
|
+
<imsmd:keyword>
|
116
|
+
<imsmd:string language="en">modal</imsmd:string>
|
117
|
+
</imsmd:keyword>
|
118
|
+
<imsmd:keyword>
|
119
|
+
<imsmd:string language="en">test</imsmd:string>
|
120
|
+
</imsmd:keyword>
|
121
|
+
<imsmd:keyword>
|
122
|
+
<imsmd:string language="en">inline</imsmd:string>
|
123
|
+
</imsmd:keyword>
|
124
|
+
<imsmd:keyword>
|
125
|
+
<imsmd:string language="en">block</imsmd:string>
|
126
|
+
</imsmd:keyword>
|
127
|
+
</imsmd:general>
|
125
128
|
</imsmd:lom>
|
126
129
|
</metadata>
|
130
|
+
<organizations/>
|
127
131
|
<resources>
|
128
132
|
<resource href="assessment.xml" type="imsqti_test_xmlv2p2" identifier="TEST">
|
129
133
|
<file href="assessment.xml"/>
|
130
|
-
<file href="
|
134
|
+
<file href="#{item_identifier}.xml"/>
|
131
135
|
</resource>
|
132
136
|
</resources>
|
133
137
|
</manifest>
|
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: 0.6.
|
4
|
+
version: 0.6.4
|
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: 2017-06-
|
12
|
+
date: 2017-06-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|