qti 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01a0bd0d6fce73ea49a9c058590efc645ae1f07b
|
4
|
+
data.tar.gz: 13814e907f52035e0ea02b49be9cff41b93f0220
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1375ddeb630a3563154ec29c8e41130e14b9c5885a46388348f270523fe040e81ec57793af37e7d9d9bdf09ae3965dada0a2b3dda31b1d66b29b5e68be25337
|
7
|
+
data.tar.gz: 6317d241aa748eb3e8543ad79b3d0d11975f828cc63818338858141cab27831a6f8a918bca3fbcde70ebeea60e481a8b6d30791966c374597261263301f35ce5
|
@@ -6,22 +6,29 @@ module Qti
|
|
6
6
|
module V1
|
7
7
|
module Models
|
8
8
|
module Interactions
|
9
|
+
ALL_CLASSES = constants.map { |c| const_get(c) }.freeze
|
10
|
+
ORDERED_CLASSES = [CanvasMultipleDropdownInteraction, FormulaInteraction, NumericInteraction].freeze
|
11
|
+
FALLBACK_CLASSES = [StringInteraction].freeze
|
9
12
|
# This one finds the correct parsing model based on the provided xml node
|
10
13
|
def self.interaction_model(node, parent)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
14
|
+
matches = Interactions.get_matches(node, parent, ORDERED_CLASSES)
|
15
|
+
return matches.first unless matches.empty?
|
16
|
+
|
17
|
+
subclasses = ALL_CLASSES - ORDERED_CLASSES - FALLBACK_CLASSES
|
16
18
|
|
17
|
-
|
19
|
+
matches = Interactions.get_matches(node, parent, subclasses)
|
20
|
+
matches = Interactions.get_matches(node, parent, FALLBACK_CLASSES) if matches.empty?
|
18
21
|
|
19
|
-
|
22
|
+
raise UnsupportedSchema if matches.size != 1
|
23
|
+
matches.first
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.get_matches(node, parent, classlist)
|
27
|
+
matches = classlist.each_with_object([]) do |interaction_class, result|
|
20
28
|
match = interaction_class.matches(node, parent)
|
21
29
|
result << match if match
|
22
30
|
end
|
23
|
-
|
24
|
-
matches.first
|
31
|
+
matches
|
25
32
|
end
|
26
33
|
end
|
27
34
|
end
|
@@ -6,16 +6,26 @@ module Qti
|
|
6
6
|
# This will know if a class matches
|
7
7
|
def self.matches(node, parent)
|
8
8
|
return false if node.at_xpath('.//xmlns:respcondition[@continue!="Yes"]/*/xmlns:other').present?
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
return false if match.blank? ||
|
15
|
-
match.attributes['fibtype']&.value == 'Decimal'
|
9
|
+
|
10
|
+
match, answers = FillBlankInteraction.match_and_answers(node)
|
11
|
+
return false if answers.blank?
|
12
|
+
return false if match.blank? || match.attributes['fibtype']&.value == 'Decimal'
|
16
13
|
new(node, parent)
|
17
14
|
end
|
18
15
|
|
16
|
+
def self.match_and_answers(node)
|
17
|
+
if BaseInteraction.canvas_multiple_fib?(node)
|
18
|
+
return [
|
19
|
+
node.at_xpath('.//xmlns:response_lid'),
|
20
|
+
node.xpath('.//xmlns:response_label')
|
21
|
+
]
|
22
|
+
end
|
23
|
+
[
|
24
|
+
node.at_xpath('.//xmlns:render_fib'),
|
25
|
+
node.xpath('.//xmlns:respcondition/xmlns:setvar/../xmlns:conditionvar/xmlns:varequal')
|
26
|
+
]
|
27
|
+
end
|
28
|
+
|
19
29
|
def canvas_multiple_fib?
|
20
30
|
BaseInteraction.canvas_multiple_fib?(@node)
|
21
31
|
end
|
@@ -90,9 +100,9 @@ module Qti
|
|
90
100
|
|
91
101
|
def answer_nodes
|
92
102
|
if canvas_multiple_fib?
|
93
|
-
|
103
|
+
node.xpath('.//xmlns:response_label')
|
94
104
|
else
|
95
|
-
|
105
|
+
node.xpath('.//xmlns:respcondition/xmlns:setvar/../xmlns:conditionvar/xmlns:varequal')
|
96
106
|
end
|
97
107
|
end
|
98
108
|
|
@@ -5,8 +5,6 @@ module Qti
|
|
5
5
|
class StringInteraction < BaseInteraction
|
6
6
|
# This will know if a class matches
|
7
7
|
def self.matches(node, parent)
|
8
|
-
return false unless node.xpath('.//xmlns:respcondition[@continue!="Yes"]/*/xmlns:other').present?
|
9
|
-
|
10
8
|
matches = node.xpath('.//xmlns:render_fib')
|
11
9
|
return false if matches.empty?
|
12
10
|
new(node, parent)
|
data/lib/qti/version.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.6
|
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: 2018-10-
|
12
|
+
date: 2018-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|