qti 2.20.2 → 2.21.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e16530dedba8c33540a05d73d7c497eb3d3d84a75891fe080443187c85a68eff
|
4
|
+
data.tar.gz: 5e83f70021c905abba7bafb12cbad27532868f972d423f21c5ca4209a00af5c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61b96b3a9dd2096b2b15766d2e577a90f225181de62ddd9f2304e2163e84e08011b31b5395157a81ce131eb3b160a94e9455de8faf1c2888488edf7168bafb03
|
7
|
+
data.tar.gz: 812ef9edf33a9b3fd1f1712767b14ab63a21f845a02df89affc98feebff7698cca561c3945eb2988e5b41ed23bdb736e697024421d20d247dc5bcdb684a5d381
|
@@ -58,12 +58,25 @@ module Qti
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
# rubocop:disable Metrics/AbcSize
|
61
62
|
def scoring_data(choice_nodes)
|
62
|
-
|
63
|
-
|
63
|
+
setvar_nodes(choice_nodes).map do |value_node|
|
64
|
+
scoring_options = {}
|
65
|
+
scoring_options['points'] = value_node.at_xpath('.//xmlns:setvar')&.content&.to_f
|
66
|
+
|
67
|
+
if value_node.attributes['correctanswer']&.value&.downcase == 'yes'
|
68
|
+
scoring_options['correct_answer'] = true
|
69
|
+
end
|
70
|
+
|
71
|
+
ScoringData.new(value_node.at_xpath('.//xmlns:varequal').content, rcardinality,
|
72
|
+
scoring_options: scoring_options)
|
64
73
|
end
|
65
|
-
|
66
|
-
|
74
|
+
end
|
75
|
+
# rubocop:enable Metrics/AbcSize
|
76
|
+
|
77
|
+
def setvar_nodes(choice_nodes)
|
78
|
+
choice_nodes.select do |choice_node|
|
79
|
+
choice_node.at_xpath('.//xmlns:setvar')&.content&.to_f&.positive?
|
67
80
|
end
|
68
81
|
end
|
69
82
|
end
|
data/lib/qti/version.rb
CHANGED
@@ -0,0 +1,69 @@
|
|
1
|
+
<?xml version="1.0"encoding="UTF-8"?>
|
2
|
+
<questestinterop xmlns="http://www.imsglobal.org/xsd/ims_qtiasiv1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/xsd/ims_qtiasiv1p2p1.xsd">
|
3
|
+
<assessment title="1.2 Import Quiz" ident="A1001">
|
4
|
+
<section title="Main" ident="S1002">
|
5
|
+
<item ident="d74b47a4abeeed159e030bfecbcecea2" title="My question title">
|
6
|
+
<itemmetadata>
|
7
|
+
<qtimetadata>
|
8
|
+
<qtimetadatafield>
|
9
|
+
<fieldlabel>question_type</fieldlabel>
|
10
|
+
<fieldentry>multiple_choice_question</fieldentry>
|
11
|
+
</qtimetadatafield>
|
12
|
+
<qtimetadatafield>
|
13
|
+
<fieldlabel>points_possible</fieldlabel>
|
14
|
+
<fieldentry>10.0</fieldentry>
|
15
|
+
</qtimetadatafield>
|
16
|
+
<qtimetadatafield>
|
17
|
+
<fieldlabel>original_answer_ids</fieldlabel>
|
18
|
+
<fieldentry>93bbcb84-3281-4d99-b243-79ba4051e654,3cd6d311-07cd-4ec0-b2db-3048e6cf1128</fieldentry>
|
19
|
+
</qtimetadatafield>
|
20
|
+
<qtimetadatafield>
|
21
|
+
<fieldlabel>assessment_question_identifierref</fieldlabel>
|
22
|
+
<fieldentry>9f47365e112840d80a79a960b1b0b6a7</fieldentry>
|
23
|
+
</qtimetadatafield>
|
24
|
+
<qtimetadatafield>
|
25
|
+
<fieldlabel>calculator_type</fieldlabel>
|
26
|
+
<fieldentry>none</fieldentry>
|
27
|
+
</qtimetadatafield>
|
28
|
+
</qtimetadata>
|
29
|
+
</itemmetadata>
|
30
|
+
<presentation>
|
31
|
+
<material>
|
32
|
+
<mattext texttype="text/html"><p>the correct answer is letter A</p></mattext>
|
33
|
+
</material>
|
34
|
+
<response_lid ident="response1" rcardinality="Single">
|
35
|
+
<render_choice>
|
36
|
+
<response_label ident="93bbcb84-3281-4d99-b243-79ba4051e654">
|
37
|
+
<material>
|
38
|
+
<mattext texttype="text/html">A</mattext>
|
39
|
+
</material>
|
40
|
+
</response_label>
|
41
|
+
<response_label ident="3cd6d311-07cd-4ec0-b2db-3048e6cf1128">
|
42
|
+
<material>
|
43
|
+
<mattext texttype="text/html">B</mattext>
|
44
|
+
</material>
|
45
|
+
</response_label>
|
46
|
+
</render_choice>
|
47
|
+
</response_lid>
|
48
|
+
</presentation>
|
49
|
+
<resprocessing>
|
50
|
+
<outcomes>
|
51
|
+
<decvar maxvalue="100" minvalue="0" varname="SCORE" vartype="Decimal"/>
|
52
|
+
</outcomes>
|
53
|
+
<respcondition>
|
54
|
+
<conditionvar>
|
55
|
+
<varequal respident="response1">93bbcb84-3281-4d99-b243-79ba4051e654</varequal>
|
56
|
+
</conditionvar>
|
57
|
+
<setvar action="Set" varname="SCORE">10.0</setvar>
|
58
|
+
</respcondition>
|
59
|
+
<respcondition correctanswer="Yes">
|
60
|
+
<conditionvar>
|
61
|
+
<varequal respident="response1">3cd6d311-07cd-4ec0-b2db-3048e6cf1128</varequal>
|
62
|
+
</conditionvar>
|
63
|
+
<setvar action="Set" varname="SCORE">5.0</setvar>
|
64
|
+
</respcondition>
|
65
|
+
</resprocessing>
|
66
|
+
</item>
|
67
|
+
</section>
|
68
|
+
</assessment>
|
69
|
+
</questestinterop>
|
@@ -244,4 +244,26 @@ describe Qti::V1::Models::AssessmentItem do
|
|
244
244
|
end
|
245
245
|
end
|
246
246
|
end
|
247
|
+
|
248
|
+
context 'multiple choice with "vary points by answer"' do
|
249
|
+
let(:file_path) { File.join('spec', 'fixtures', 'items_1.2', 'choice_vary_points_by_answer.xml') }
|
250
|
+
let(:test_object) { Qti::V1::Models::Assessment.from_path!(file_path) }
|
251
|
+
let(:assessment_item_refs) { test_object.assessment_items }
|
252
|
+
let(:loaded_class) { described_class.new(assessment_item_refs.first) }
|
253
|
+
|
254
|
+
describe '#scoring_data_structs' do
|
255
|
+
it 'collects all the correct answers' do
|
256
|
+
struct = loaded_class.scoring_data_structs
|
257
|
+
expect(struct.size).to eq 2
|
258
|
+
expect(struct.map(&:values)).to eq %w[93bbcb84-3281-4d99-b243-79ba4051e654 3cd6d311-07cd-4ec0-b2db-3048e6cf1128]
|
259
|
+
end
|
260
|
+
|
261
|
+
it 'collect all the points answer points' do
|
262
|
+
struct = loaded_class.scoring_data_structs
|
263
|
+
expect(struct.size).to eq 2
|
264
|
+
expect(struct.map(&:scoring_options)).to eq([{ 'points' => 10.0 },
|
265
|
+
{ 'points' => 5.0, 'correct_answer' => true }])
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
247
269
|
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: 2.
|
4
|
+
version: 2.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Diaz
|
@@ -402,6 +402,7 @@ files:
|
|
402
402
|
- spec/fixtures/items_1.2/canvas_multiple_fib_extra_brackets.xml
|
403
403
|
- spec/fixtures/items_1.2/categorization.xml
|
404
404
|
- spec/fixtures/items_1.2/choice.xml
|
405
|
+
- spec/fixtures/items_1.2/choice_vary_points_by_answer.xml
|
405
406
|
- spec/fixtures/items_1.2/essay.xml
|
406
407
|
- spec/fixtures/items_1.2/fib.xml
|
407
408
|
- spec/fixtures/items_1.2/fib_feedback.xml
|
@@ -777,6 +778,7 @@ test_files:
|
|
777
778
|
- spec/fixtures/items_1.2/canvas_multiple_fib_extra_brackets.xml
|
778
779
|
- spec/fixtures/items_1.2/categorization.xml
|
779
780
|
- spec/fixtures/items_1.2/choice.xml
|
781
|
+
- spec/fixtures/items_1.2/choice_vary_points_by_answer.xml
|
780
782
|
- spec/fixtures/items_1.2/essay.xml
|
781
783
|
- spec/fixtures/items_1.2/fib.xml
|
782
784
|
- spec/fixtures/items_1.2/fib_feedback.xml
|