qti 2.22.0 → 2.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qti/v1/models/interactions/choice_interaction.rb +8 -1
- data/lib/qti/v1/models/interactions/match_interaction.rb +8 -0
- data/lib/qti/version.rb +1 -1
- data/spec/fixtures/items_1.2/choice.xml +4 -0
- data/spec/fixtures/items_1.2/matching.xml +20 -0
- data/spec/fixtures/items_1.2/multiple_answer.xml +20 -0
- data/spec/lib/qti/v1/models/interactions/choice_interaction_spec.rb +12 -0
- data/spec/lib/qti/v1/models/interactions/match_interaction_spec.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 226c095ecb34ca04b13cfd9f81f39322b95317290c2e26ba4c01a1fb96fba029
|
4
|
+
data.tar.gz: 8053d9550e1a7bfca1a6b510e63bbae3ae8e57981281e2e651488addcc6361af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ec199fed12c9b46b9a7f7ea3ed74aaeaf2877e6202d13e4fc5da4c30ca225f38832473b13d3653a1a9ef0a4fa1e7d4fb7ac0d6a1e287c825aafa534425450ee
|
7
|
+
data.tar.gz: 7c3146c9f00d6fd745b2cd9046e0614ffb44db07484659bd2cb11099e37f719c30f03a18431b12bdf76df62072ff78f17bbbd5a594952e5a1d3916a1f95f5d93
|
@@ -44,6 +44,13 @@ module Qti
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
def scoring_algorithm
|
48
|
+
scoring_algorithm_path = './/xmlns:qtimetadatafield/xmlns:fieldlabel' \
|
49
|
+
'[text()="scoring_algorithm"]/../xmlns:fieldentry'
|
50
|
+
|
51
|
+
node.at_xpath(scoring_algorithm_path)&.text
|
52
|
+
end
|
53
|
+
|
47
54
|
private
|
48
55
|
|
49
56
|
def answer_nodes
|
@@ -72,8 +79,8 @@ module Qti
|
|
72
79
|
scoring_options: scoring_options)
|
73
80
|
end
|
74
81
|
end
|
75
|
-
# rubocop:enable Metrics/AbcSize
|
76
82
|
|
83
|
+
# rubocop:enable Metrics/AbcSize
|
77
84
|
def setvar_nodes(choice_nodes)
|
78
85
|
choice_nodes.select do |choice_node|
|
79
86
|
choice_node.at_xpath('.//xmlns:setvar')&.content&.to_f&.positive?
|
@@ -35,6 +35,13 @@ module Qti
|
|
35
35
|
all.reject { |v| correct.include? v }
|
36
36
|
end
|
37
37
|
|
38
|
+
def scoring_algorithm
|
39
|
+
scoring_algorithm_path = './/xmlns:qtimetadatafield/xmlns:fieldlabel' \
|
40
|
+
'[text()="scoring_algorithm"]/../xmlns:fieldentry'
|
41
|
+
|
42
|
+
node.at_xpath(scoring_algorithm_path)&.text
|
43
|
+
end
|
44
|
+
|
38
45
|
private
|
39
46
|
|
40
47
|
def parse_scoring_data
|
@@ -43,6 +50,7 @@ module Qti
|
|
43
50
|
matches = node.xpath(path).map do |node|
|
44
51
|
[node.attributes['respident'].value, answers_map[node.content]]
|
45
52
|
end
|
53
|
+
|
46
54
|
[Models::ScoringData.new(Hash[matches], rcardinality)]
|
47
55
|
end
|
48
56
|
|
data/lib/qti/version.rb
CHANGED
@@ -220,6 +220,10 @@
|
|
220
220
|
<fieldentry>i50a52b1e8b3e61e8e4f56b30182a3f6f</fieldentry>
|
221
221
|
</qtimetadatafield>
|
222
222
|
</qtimetadata>
|
223
|
+
<qtimetadatafield>
|
224
|
+
<fieldlabel>scoring_algorithm</fieldlabel>
|
225
|
+
<fieldentry>AllOrNothing</fieldentry>
|
226
|
+
</qtimetadatafield>
|
223
227
|
</itemmetadata>
|
224
228
|
<presentation>
|
225
229
|
<material>
|
@@ -70,5 +70,25 @@
|
|
70
70
|
<setvar varname="SCORE" action="Add">50.00</setvar>
|
71
71
|
</respcondition>
|
72
72
|
</resprocessing>
|
73
|
+
<itemmetadata>
|
74
|
+
<qtimetadata>
|
75
|
+
<qtimetadatafield>
|
76
|
+
<fieldlabel>question_type</fieldlabel>
|
77
|
+
<fieldentry>multiple_answers_question</fieldentry>
|
78
|
+
</qtimetadatafield>
|
79
|
+
<qtimetadatafield>
|
80
|
+
<fieldlabel>points_possible</fieldlabel>
|
81
|
+
<fieldentry>1.0</fieldentry>
|
82
|
+
</qtimetadatafield>
|
83
|
+
<qtimetadatafield>
|
84
|
+
<fieldlabel>assessment_question_identifierref</fieldlabel>
|
85
|
+
<fieldentry>i50a52b1e8b3e61e8e4f56b30182a3f6f</fieldentry>
|
86
|
+
</qtimetadatafield>
|
87
|
+
</qtimetadata>
|
88
|
+
<qtimetadatafield>
|
89
|
+
<fieldlabel>scoring_algorithm</fieldlabel>
|
90
|
+
<fieldentry>AllOrNothing</fieldentry>
|
91
|
+
</qtimetadatafield>
|
92
|
+
</itemmetadata>
|
73
93
|
</item>
|
74
94
|
</questestinterop>
|
@@ -94,6 +94,26 @@
|
|
94
94
|
<setvar varname="que_score" action="Add">25.00</setvar>
|
95
95
|
</respcondition>
|
96
96
|
</resprocessing>
|
97
|
+
<itemmetadata>
|
98
|
+
<qtimetadata>
|
99
|
+
<qtimetadatafield>
|
100
|
+
<fieldlabel>question_type</fieldlabel>
|
101
|
+
<fieldentry>multiple_answers_question</fieldentry>
|
102
|
+
</qtimetadatafield>
|
103
|
+
<qtimetadatafield>
|
104
|
+
<fieldlabel>points_possible</fieldlabel>
|
105
|
+
<fieldentry>1.0</fieldentry>
|
106
|
+
</qtimetadatafield>
|
107
|
+
<qtimetadatafield>
|
108
|
+
<fieldlabel>assessment_question_identifierref</fieldlabel>
|
109
|
+
<fieldentry>i50a52b1e8b3e61e8e4f56b30182a3f6f</fieldentry>
|
110
|
+
</qtimetadatafield>
|
111
|
+
</qtimetadata>
|
112
|
+
<qtimetadatafield>
|
113
|
+
<fieldlabel>scoring_algorithm</fieldlabel>
|
114
|
+
<fieldentry>AllOrNothing</fieldentry>
|
115
|
+
</qtimetadatafield>
|
116
|
+
</itemmetadata>
|
97
117
|
</item>
|
98
118
|
</section>
|
99
119
|
</assessment>
|
@@ -41,6 +41,10 @@ describe Qti::V1::Models::Interactions::ChoiceInteraction do
|
|
41
41
|
include_examples 'locked_choices'
|
42
42
|
include_examples 'answers'
|
43
43
|
include_examples 'meta_type'
|
44
|
+
|
45
|
+
it 'does not have any scoring algorithm' do
|
46
|
+
expect(loaded_class.scoring_algorithm).to eq nil
|
47
|
+
end
|
44
48
|
end
|
45
49
|
|
46
50
|
context 'true_false.xml' do
|
@@ -61,6 +65,10 @@ describe Qti::V1::Models::Interactions::ChoiceInteraction do
|
|
61
65
|
let(:shuffle_value) { false }
|
62
66
|
let(:locked_choices_value) { [] }
|
63
67
|
|
68
|
+
it 'has the correct scoring algorithm' do
|
69
|
+
expect(loaded_class.scoring_algorithm).to eq 'AllOrNothing'
|
70
|
+
end
|
71
|
+
|
64
72
|
include_examples 'shuffled?'
|
65
73
|
include_examples 'locked_choices'
|
66
74
|
end
|
@@ -75,6 +83,10 @@ describe Qti::V1::Models::Interactions::ChoiceInteraction do
|
|
75
83
|
include_examples 'shuffled?'
|
76
84
|
include_examples 'locked_choices'
|
77
85
|
include_examples 'meta_type'
|
86
|
+
|
87
|
+
it 'does not have any scoring algorithm' do
|
88
|
+
expect(loaded_class.scoring_algorithm).to eq nil
|
89
|
+
end
|
78
90
|
end
|
79
91
|
|
80
92
|
context 'multiple respconditions with empty setvars' do
|
@@ -59,6 +59,10 @@ describe Qti::V1::Models::Interactions::MatchInteraction do
|
|
59
59
|
end
|
60
60
|
let(:expected_distractors) { ['A distractor answer.'] }
|
61
61
|
|
62
|
+
it 'has the correct scoring algorithm' do
|
63
|
+
expect(subject.scoring_algorithm).to eq 'AllOrNothing'
|
64
|
+
end
|
65
|
+
|
62
66
|
include_examples('common features')
|
63
67
|
include_examples('questions and answers')
|
64
68
|
include_examples('#scoring_data_structs')
|
@@ -88,5 +92,9 @@ describe Qti::V1::Models::Interactions::MatchInteraction do
|
|
88
92
|
include_examples('common features')
|
89
93
|
include_examples('questions and answers')
|
90
94
|
include_examples('#scoring_data_structs')
|
95
|
+
|
96
|
+
it 'does not have any scoring algorithm' do
|
97
|
+
expect(subject.scoring_algorithm).to eq nil
|
98
|
+
end
|
91
99
|
end
|
92
100
|
end
|