qti 0.0.2 → 0.1.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/README.md +4 -0
- data/lib/qti/v1/models/interactions/string_interaction.rb +23 -0
- data/lib/qti/v2/models/interactions/extended_text_interaction.rb +36 -0
- data/spec/fixtures/items_2.1/essay.xml +9 -9
- data/spec/qti/v2/models/interactions/extended_text_interaction_spec.rb +22 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97fae2a423b897f6bd3195a31da3770b967d9ca2
|
4
|
+
data.tar.gz: d04fb9572ee17b2313dfe3e11d446ddafaed9780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39e248def2e8e645cdca5661c0e92e0b665fe57a9ef8c4b19cfd818c2c95150528899e8a40a5d83aad90c80fb3531c27017eaa3ae1c29bbb3f861f0c5e3c3371
|
7
|
+
data.tar.gz: 2f2a67077b6e32b8d8888109fe695b91b6bf103aef5559a81ed15dbcc4e9ca5c71937032170607448b3890dacc37c65263c52afb94c5ce562bb347ff82f8fee9
|
data/README.md
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Qti
|
2
|
+
module V1
|
3
|
+
module Models
|
4
|
+
module Interactions
|
5
|
+
class StringInteraction < Qti::V1::Models::Base
|
6
|
+
NODE_NAME = 'response_str'.freeze
|
7
|
+
# This will know if a class matches
|
8
|
+
def self.matches(node)
|
9
|
+
matches = node.children.children.select { |n| n.name == NODE_NAME }
|
10
|
+
return false if matches.empty?
|
11
|
+
|
12
|
+
raise Qti::UnsupportedSchema if matches.size > 1
|
13
|
+
new(matches.first)
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(node)
|
17
|
+
@node = node
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Qti
|
2
|
+
module V2
|
3
|
+
module Models
|
4
|
+
module Interactions
|
5
|
+
class ExtendedTextInteraction < Qti::V2::Models::Base
|
6
|
+
NODE_NAME = 'extendedTextInteraction'.freeze
|
7
|
+
# This will know if a class matches
|
8
|
+
def self.matches(node)
|
9
|
+
matches = node.children.filter(INTERACTION_ELEMENTS_CSS).select { |n| n.name == NODE_NAME }
|
10
|
+
return false if matches.empty?
|
11
|
+
|
12
|
+
raise Qti::UnsupportedSchema if matches.size > 1
|
13
|
+
new(matches.first)
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(node)
|
17
|
+
@node = node
|
18
|
+
end
|
19
|
+
|
20
|
+
# not used yet
|
21
|
+
def expected_lines
|
22
|
+
@node.attributes['expectedLines']&.value&.to_i || 0
|
23
|
+
end
|
24
|
+
|
25
|
+
def max_strings
|
26
|
+
@node.attributes['maxStrings']&.value&.to_i
|
27
|
+
end
|
28
|
+
|
29
|
+
def min_strings
|
30
|
+
@node.attributes['minStrings']&.value&.to_i || 0
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p2"
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<extendedTextInteraction responseIdentifier="RESPONSE">
|
3
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
4
|
+
xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2.xsd"
|
5
|
+
identifier="essay" title="Write an essay" adaptive="false" timeDependent="false">
|
6
|
+
<responseDeclaration identifier="RESPONSE" cardinality="single" baseType="string"/>
|
7
|
+
<outcomeDeclaration identifier="SCORE" cardinality="single" baseType="float" externalScored="human" normalMaximum="25"/>
|
8
|
+
<itemBody>
|
9
|
+
<p>In the class room, we discovered Martin Luther King Jr. and his devotion.</p>
|
10
|
+
<extendedTextInteraction responseIdentifier="RESPONSE" minStrings="1" maxStrings="500">
|
11
11
|
<prompt><b>Write an abstract about the life of this historical figure.</b></prompt>
|
12
12
|
</extendedTextInteraction>
|
13
|
-
|
13
|
+
</itemBody>
|
14
14
|
</assessmentItem>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Qti::V2::Models::Interactions::ExtendedTextInteraction do
|
4
|
+
context 'essay.xml' do
|
5
|
+
let(:io) { File.read(File.join('spec', 'fixtures', 'items_2.1', 'essay.xml')) }
|
6
|
+
let(:node) { Nokogiri::XML(io).at_xpath('//xmlns:extendedTextInteraction') }
|
7
|
+
|
8
|
+
let(:loaded_class) { described_class.new(node) }
|
9
|
+
|
10
|
+
it 'returns the expected lines' do
|
11
|
+
expect(loaded_class.expected_lines).to eq 0
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'returns the max choices count' do
|
15
|
+
expect(loaded_class.max_strings).to eq 500
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'returns the min strings' do
|
19
|
+
expect(loaded_class.min_strings).to eq 1
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hannah Bottalla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,12 +126,14 @@ files:
|
|
126
126
|
- lib/qti/v1/models/base.rb
|
127
127
|
- lib/qti/v1/models/choices/logical_identifier_choice.rb
|
128
128
|
- lib/qti/v1/models/interactions/logical_identifier_interaction.rb
|
129
|
+
- lib/qti/v1/models/interactions/string_interaction.rb
|
129
130
|
- lib/qti/v2/models/assessment_item.rb
|
130
131
|
- lib/qti/v2/models/assessment_test.rb
|
131
132
|
- lib/qti/v2/models/base.rb
|
132
133
|
- lib/qti/v2/models/choices/simple_choice.rb
|
133
134
|
- lib/qti/v2/models/interactions.rb
|
134
135
|
- lib/qti/v2/models/interactions/choice_interaction.rb
|
136
|
+
- lib/qti/v2/models/interactions/extended_text_interaction.rb
|
135
137
|
- spec/fixtures/items_1.2/multiple_answer.xml
|
136
138
|
- spec/fixtures/items_1.2/multiple_choice.xml
|
137
139
|
- spec/fixtures/items_1.2/true_false.xml
|
@@ -304,6 +306,7 @@ files:
|
|
304
306
|
- spec/qti/v2/models/assessment_test_spec.rb
|
305
307
|
- spec/qti/v2/models/choices/simple_choice_spec.rb
|
306
308
|
- spec/qti/v2/models/interactions/choice_interaction_spec.rb
|
309
|
+
- spec/qti/v2/models/interactions/extended_text_interaction_spec.rb
|
307
310
|
- spec/qti_spec.rb
|
308
311
|
- spec/spec_helper.rb
|
309
312
|
homepage:
|
@@ -502,5 +505,6 @@ test_files:
|
|
502
505
|
- spec/qti/v2/models/assessment_test_spec.rb
|
503
506
|
- spec/qti/v2/models/choices/simple_choice_spec.rb
|
504
507
|
- spec/qti/v2/models/interactions/choice_interaction_spec.rb
|
508
|
+
- spec/qti/v2/models/interactions/extended_text_interaction_spec.rb
|
505
509
|
- spec/qti_spec.rb
|
506
510
|
- spec/spec_helper.rb
|