qti 0.2.12 → 0.2.14
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/Rakefile +9 -1
- data/lib/qti/v1/models/assessment.rb +2 -2
- data/lib/qti/v1/models/assessment_item.rb +5 -29
- data/lib/qti/v1/models/interactions/base_interaction.rb +33 -0
- data/lib/qti/v1/models/interactions/choice_interaction.rb +44 -0
- data/lib/qti/v1/models/interactions/match_interaction.rb +60 -0
- data/lib/qti/v1/models/interactions/ordering_interaction.rb +23 -0
- data/lib/qti/v1/models/interactions/string_interaction.rb +1 -3
- data/lib/qti/v1/models/interactions.rb +1 -3
- data/lib/qti/v1/models/scoring_data.rb +7 -0
- data/lib/qti/v2/models/assessment_item.rb +2 -6
- data/lib/qti/v2/models/choices/simple_associable_choice.rb +12 -0
- data/lib/qti/v2/models/interactions/base_interaction.rb +43 -0
- data/lib/qti/v2/models/interactions/choice_interaction.rb +2 -12
- data/lib/qti/v2/models/interactions/extended_text_interaction.rb +1 -5
- data/lib/qti/v2/models/interactions/match_interaction.rb +52 -0
- data/lib/qti/v2/models/scoring_data.rb +7 -0
- data/lib/qti.rb +6 -0
- data/spec/fixtures/items_1.2/matching.xml +74 -0
- data/spec/fixtures/items_1.2/multiple_answer.xml +1 -1
- data/spec/fixtures/items_1.2/multiple_choice.xml +1 -1
- data/spec/fixtures/items_1.2/ordering.xml +20 -20
- data/spec/fixtures/items_1.2/true_false.xml +1 -1
- data/spec/fixtures/items_2.1/match.xml +33 -39
- data/spec/fixtures/test_qti_1.2/quiz.xml +209 -216
- data/spec/lib/qti/v1/models/assessment_item_spec.rb +20 -2
- data/spec/lib/qti/v1/models/interactions/{logical_identifier_interaction_spec.rb → choice_interaction_spec.rb} +1 -1
- data/spec/lib/qti/v2/models/assessment_item_spec.rb +24 -0
- metadata +15 -5
- data/lib/qti/v1/models/interactions/logical_identifier_interaction.rb +0 -36
@@ -37,7 +37,25 @@ describe Qti::V1::Models::AssessmentItem do
|
|
37
37
|
assessment = Qti::V1::Models::Assessment.from_path! 'spec/fixtures/items_1.2/ordering.xml'
|
38
38
|
assessment_item = described_class.new(assessment.assessment_items.first)
|
39
39
|
expect(assessment_item.scoring_data_structs.count).to eq 1
|
40
|
-
expect(assessment_item.scoring_data_structs.first.values).to eq
|
40
|
+
expect(assessment_item.scoring_data_structs.first.values).to eq %w(A B E D C)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'grabs scoring data value for matching questions' do
|
44
|
+
assessment = Qti::V1::Models::Assessment.from_path! 'spec/fixtures/items_1.2/matching.xml'
|
45
|
+
assessment_item = described_class.new(assessment.assessment_items.first)
|
46
|
+
expect(assessment_item.interaction_model.questions).to eq(
|
47
|
+
[{ id: 'question_1', question_body: 'Light Microscope' },
|
48
|
+
{ id: 'question_2', question_body: 'Electron Microscopes' }]
|
49
|
+
)
|
50
|
+
expect(assessment_item.scoring_data_structs.first.values).to eq(
|
51
|
+
'question_1' => 'Magnify up to about 400 times. Sometimes requires colored staining of cells.',
|
52
|
+
'question_2' => "Uses a beam of electrons. Can provide details of cells' internal structure."
|
53
|
+
)
|
54
|
+
expect(assessment_item.interaction_model.answers.map(&:item_body)).to eq(
|
55
|
+
['Magnify up to about 400 times. Sometimes requires colored staining of cells.',
|
56
|
+
"Uses a beam of electrons. Can provide details of cells' internal structure.",
|
57
|
+
'A distractor answer.']
|
58
|
+
)
|
41
59
|
end
|
42
60
|
end
|
43
61
|
|
@@ -51,7 +69,7 @@ describe Qti::V1::Models::AssessmentItem do
|
|
51
69
|
|
52
70
|
it 'loads the correct interaction model' do
|
53
71
|
expect(loaded_class.interaction_model).to be_an_instance_of(
|
54
|
-
Qti::V1::Models::Interactions::
|
72
|
+
Qti::V1::Models::Interactions::ChoiceInteraction
|
55
73
|
)
|
56
74
|
end
|
57
75
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Qti::V1::Models::Interactions::
|
3
|
+
describe Qti::V1::Models::Interactions::ChoiceInteraction do
|
4
4
|
context 'quiz.xml' do
|
5
5
|
let(:fixtures_path) { File.join('spec', 'fixtures') }
|
6
6
|
let(:file_path) { File.join(fixtures_path, 'test_qti_1.2', 'quiz.xml') }
|
@@ -64,4 +64,28 @@ describe Qti::V2::Models::AssessmentItem do
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
67
|
+
|
68
|
+
describe '#scoring_data_structs' do
|
69
|
+
it 'grabs scoring data value for matching questions' do
|
70
|
+
assessment_item = Qti::V2::Models::AssessmentItem.from_path! 'spec/fixtures/items_2.1/match.xml'
|
71
|
+
expect(assessment_item.interaction_model).to be_instance_of Qti::V2::Models::Interactions::MatchInteraction
|
72
|
+
expect(assessment_item.scoring_data_structs.first.values).to eq(
|
73
|
+
'C' => 'Romeo and Juliet',
|
74
|
+
'D' => "A Midsummer-Night's Dream",
|
75
|
+
'L' => "A Midsummer-Night's Dream",
|
76
|
+
'P' => 'The Tempest'
|
77
|
+
)
|
78
|
+
expect(assessment_item.interaction_model.questions).to eq(
|
79
|
+
[{ id: 'C', question_body: 'Capulet' },
|
80
|
+
{ id: 'D', question_body: 'Demetrius' },
|
81
|
+
{ id: 'L', question_body: 'Lysander' },
|
82
|
+
{ id: 'P', question_body: 'Prospero' }]
|
83
|
+
)
|
84
|
+
expect(assessment_item.interaction_model.answers.map(&:item_body)).to eq(
|
85
|
+
["A Midsummer-Night's Dream",
|
86
|
+
'Romeo and Juliet',
|
87
|
+
'The Tempest']
|
88
|
+
)
|
89
|
+
end
|
90
|
+
end
|
67
91
|
end
|
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.2.
|
4
|
+
version: 0.2.14
|
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-04-
|
12
|
+
date: 2017-04-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -207,15 +207,24 @@ files:
|
|
207
207
|
- lib/qti/v1/models/base.rb
|
208
208
|
- lib/qti/v1/models/choices/logical_identifier_choice.rb
|
209
209
|
- lib/qti/v1/models/interactions.rb
|
210
|
-
- lib/qti/v1/models/interactions/
|
210
|
+
- lib/qti/v1/models/interactions/base_interaction.rb
|
211
|
+
- lib/qti/v1/models/interactions/choice_interaction.rb
|
212
|
+
- lib/qti/v1/models/interactions/match_interaction.rb
|
213
|
+
- lib/qti/v1/models/interactions/ordering_interaction.rb
|
211
214
|
- lib/qti/v1/models/interactions/string_interaction.rb
|
215
|
+
- lib/qti/v1/models/scoring_data.rb
|
212
216
|
- lib/qti/v2/models/assessment_item.rb
|
213
217
|
- lib/qti/v2/models/assessment_test.rb
|
214
218
|
- lib/qti/v2/models/base.rb
|
219
|
+
- lib/qti/v2/models/choices/simple_associable_choice.rb
|
215
220
|
- lib/qti/v2/models/choices/simple_choice.rb
|
216
221
|
- lib/qti/v2/models/interactions.rb
|
222
|
+
- lib/qti/v2/models/interactions/base_interaction.rb
|
217
223
|
- lib/qti/v2/models/interactions/choice_interaction.rb
|
218
224
|
- lib/qti/v2/models/interactions/extended_text_interaction.rb
|
225
|
+
- lib/qti/v2/models/interactions/match_interaction.rb
|
226
|
+
- lib/qti/v2/models/scoring_data.rb
|
227
|
+
- spec/fixtures/items_1.2/matching.xml
|
219
228
|
- spec/fixtures/items_1.2/multiple_answer.xml
|
220
229
|
- spec/fixtures/items_1.2/multiple_choice.xml
|
221
230
|
- spec/fixtures/items_1.2/ordering.xml
|
@@ -401,7 +410,7 @@ files:
|
|
401
410
|
- spec/lib/qti/v1/models/assessment_item_spec.rb
|
402
411
|
- spec/lib/qti/v1/models/assessment_spec.rb
|
403
412
|
- spec/lib/qti/v1/models/choices/logical_identifier_choice_spec.rb
|
404
|
-
- spec/lib/qti/v1/models/interactions/
|
413
|
+
- spec/lib/qti/v1/models/interactions/choice_interaction_spec.rb
|
405
414
|
- spec/lib/qti/v2/models/assessment_item_spec.rb
|
406
415
|
- spec/lib/qti/v2/models/assessment_test_spec.rb
|
407
416
|
- spec/lib/qti/v2/models/choices/simple_choice_spec.rb
|
@@ -434,6 +443,7 @@ signing_key:
|
|
434
443
|
specification_version: 4
|
435
444
|
summary: QTI 1.2 and 2.1 import and export models
|
436
445
|
test_files:
|
446
|
+
- spec/fixtures/items_1.2/matching.xml
|
437
447
|
- spec/fixtures/items_1.2/multiple_answer.xml
|
438
448
|
- spec/fixtures/items_1.2/multiple_choice.xml
|
439
449
|
- spec/fixtures/items_1.2/ordering.xml
|
@@ -619,7 +629,7 @@ test_files:
|
|
619
629
|
- spec/lib/qti/v1/models/assessment_item_spec.rb
|
620
630
|
- spec/lib/qti/v1/models/assessment_spec.rb
|
621
631
|
- spec/lib/qti/v1/models/choices/logical_identifier_choice_spec.rb
|
622
|
-
- spec/lib/qti/v1/models/interactions/
|
632
|
+
- spec/lib/qti/v1/models/interactions/choice_interaction_spec.rb
|
623
633
|
- spec/lib/qti/v2/models/assessment_item_spec.rb
|
624
634
|
- spec/lib/qti/v2/models/assessment_test_spec.rb
|
625
635
|
- spec/lib/qti/v2/models/choices/simple_choice_spec.rb
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Qti
|
2
|
-
module V1
|
3
|
-
module Models
|
4
|
-
module Interactions
|
5
|
-
class LogicalIdentifierInteraction < Qti::V1::Models::Base
|
6
|
-
# This will know if a class matches
|
7
|
-
def self.matches(node)
|
8
|
-
match = node.at_xpath('.//response_lid')
|
9
|
-
return false unless match.present?
|
10
|
-
new(match)
|
11
|
-
end
|
12
|
-
|
13
|
-
def initialize(node)
|
14
|
-
@node = node
|
15
|
-
end
|
16
|
-
|
17
|
-
def shuffled?
|
18
|
-
@node.at_xpath('.//render_choice/@shuffle')&.value == 'Yes'
|
19
|
-
end
|
20
|
-
|
21
|
-
def answers
|
22
|
-
@answers ||= answer_nodes.map do |node|
|
23
|
-
V1::Models::Choices::LogicalIdentifierChoice.new(node)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def answer_nodes
|
30
|
-
@node.xpath('.//response_label')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|