qti 2.15.2 → 2.15.3
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/lib/qti/v1/models/numerics/margin_error.rb +7 -2
- data/lib/qti/v1/models/numerics/precision.rb +10 -2
- data/lib/qti/version.rb +1 -1
- data/spec/fixtures/items_1.2/numeric_margin_error_percent.xml +58 -0
- data/spec/fixtures/items_1.2/numeric_precision_decimals.xml +58 -0
- data/spec/lib/qti/v1/models/interactions/numeric_interaction_spec.rb +31 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4d749cfb13026e00cdeabff06146d77241250a608825bff4b289ea632f24561
|
4
|
+
data.tar.gz: caa73136c519b5534c2309d73e5af6e5e4fdee04e7b22fb5065c5913abdc90d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01adeaad50a2f1247b5e5ced354a23db01781892b638bf4644df44facd17cd02853be8b5a96d55fcd911dcb9b98519937c628f9733373e331eaeb2dc6c774dae
|
7
|
+
data.tar.gz: 8ce6a9332d85cae1a0174b64c799c447a99f18a3096d8f0d0c7d507ebec1bc57708c20d25be6a4d3db0b0f2eaf2786ca628d2bf368d5812151c0c2568bad8243
|
@@ -16,14 +16,19 @@ module Qti
|
|
16
16
|
'marginOfError',
|
17
17
|
equal_node.content.to_f.to_s,
|
18
18
|
margin,
|
19
|
-
|
19
|
+
margin_type
|
20
20
|
)
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def margin
|
26
|
-
|
26
|
+
equal_node.attributes['margin']&.value ||
|
27
|
+
(equal_node.content.to_f - gte_node.content.to_f).to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
def margin_type
|
31
|
+
equal_node.attributes['margintype']&.value || 'absolute'
|
27
32
|
end
|
28
33
|
|
29
34
|
def valid?
|
@@ -18,16 +18,20 @@ module Qti
|
|
18
18
|
'preciseResponse',
|
19
19
|
value,
|
20
20
|
precision.to_s,
|
21
|
-
|
21
|
+
precision_type
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
25
25
|
def value
|
26
26
|
fval = equal_node.content.to_f
|
27
|
-
number_with_precision(fval, precision: precision, significant:
|
27
|
+
number_with_precision(fval, precision: precision, significant: precision_type == 'significantDigits')
|
28
28
|
end
|
29
29
|
|
30
30
|
def precision
|
31
|
+
overridden_precision = equal_node.attributes['precision']&.value
|
32
|
+
|
33
|
+
return overridden_precision.to_i if overridden_precision.present?
|
34
|
+
|
31
35
|
sig = [
|
32
36
|
Precision.significant_digits(gt_node.content),
|
33
37
|
Precision.significant_digits(lte_node.content)
|
@@ -35,6 +39,10 @@ module Qti
|
|
35
39
|
sig - 1
|
36
40
|
end
|
37
41
|
|
42
|
+
def precision_type
|
43
|
+
equal_node.attributes['precisiontype']&.value || 'significantDigits'
|
44
|
+
end
|
45
|
+
|
38
46
|
def self.significant_digits(number_s)
|
39
47
|
sig = 0
|
40
48
|
zeros = 0
|
data/lib/qti/version.rb
CHANGED
@@ -0,0 +1,58 @@
|
|
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 ident="i3c06f375b6b24a39925dc6a213421021" title="Quiz1.Margin.Error">
|
4
|
+
<qtimetadata>
|
5
|
+
<qtimetadatafield>
|
6
|
+
<fieldlabel>cc_maxattempts</fieldlabel>
|
7
|
+
<fieldentry>1</fieldentry>
|
8
|
+
</qtimetadatafield>
|
9
|
+
</qtimetadata>
|
10
|
+
<section ident="root_section">
|
11
|
+
<item ident="i028a5c60d8ce9dc63df3afefa2e9d01e" title="Question">
|
12
|
+
<itemmetadata>
|
13
|
+
<qtimetadata>
|
14
|
+
<qtimetadatafield>
|
15
|
+
<fieldlabel>question_type</fieldlabel>
|
16
|
+
<fieldentry>numerical_question</fieldentry>
|
17
|
+
</qtimetadatafield>
|
18
|
+
<qtimetadatafield>
|
19
|
+
<fieldlabel>points_possible</fieldlabel>
|
20
|
+
<fieldentry>1.0</fieldentry>
|
21
|
+
</qtimetadatafield>
|
22
|
+
<qtimetadatafield>
|
23
|
+
<fieldlabel>assessment_question_identifierref</fieldlabel>
|
24
|
+
<fieldentry>i874908082e9dce80647f2771296ca69c</fieldentry>
|
25
|
+
</qtimetadatafield>
|
26
|
+
</qtimetadata>
|
27
|
+
</itemmetadata>
|
28
|
+
<presentation>
|
29
|
+
<material>
|
30
|
+
<mattext texttype="text/html"><div><p>QQ1.margin error</p></div></mattext>
|
31
|
+
</material>
|
32
|
+
<response_str ident="response1" rcardinality="Single">
|
33
|
+
<render_fib fibtype="Decimal">
|
34
|
+
<response_label ident="answer1"/>
|
35
|
+
</render_fib>
|
36
|
+
</response_str>
|
37
|
+
</presentation>
|
38
|
+
<resprocessing>
|
39
|
+
<outcomes>
|
40
|
+
<decvar maxvalue="100" minvalue="0" varname="SCORE" vartype="Decimal"/>
|
41
|
+
</outcomes>
|
42
|
+
<respcondition continue="No">
|
43
|
+
<conditionvar>
|
44
|
+
<or>
|
45
|
+
<varequal respident="response1" margintype="percent" margin="20.0">200.0</varequal>
|
46
|
+
<and>
|
47
|
+
<vargte respident="response1">160.0</vargte>
|
48
|
+
<varlte respident="response1">240.0</varlte>
|
49
|
+
</and>
|
50
|
+
</or>
|
51
|
+
</conditionvar>
|
52
|
+
<setvar action="Set" varname="SCORE">100</setvar>
|
53
|
+
</respcondition>
|
54
|
+
</resprocessing>
|
55
|
+
</item>
|
56
|
+
</section>
|
57
|
+
</assessment>
|
58
|
+
</questestinterop>
|
@@ -0,0 +1,58 @@
|
|
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 ident="id2b817165c302c0c57416146dc94ce47" title="Quiz1.precision">
|
4
|
+
<qtimetadata>
|
5
|
+
<qtimetadatafield>
|
6
|
+
<fieldlabel>cc_maxattempts</fieldlabel>
|
7
|
+
<fieldentry>1</fieldentry>
|
8
|
+
</qtimetadatafield>
|
9
|
+
</qtimetadata>
|
10
|
+
<section ident="root_section">
|
11
|
+
<item ident="i3ac3c6ccf4dd3dce4d5b5a5721edd5d5" title="Question">
|
12
|
+
<itemmetadata>
|
13
|
+
<qtimetadata>
|
14
|
+
<qtimetadatafield>
|
15
|
+
<fieldlabel>question_type</fieldlabel>
|
16
|
+
<fieldentry>numerical_question</fieldentry>
|
17
|
+
</qtimetadatafield>
|
18
|
+
<qtimetadatafield>
|
19
|
+
<fieldlabel>points_possible</fieldlabel>
|
20
|
+
<fieldentry>1.0</fieldentry>
|
21
|
+
</qtimetadatafield>
|
22
|
+
<qtimetadatafield>
|
23
|
+
<fieldlabel>assessment_question_identifierref</fieldlabel>
|
24
|
+
<fieldentry>i792f29a40533189006a3bd7ffee3c857</fieldentry>
|
25
|
+
</qtimetadatafield>
|
26
|
+
</qtimetadata>
|
27
|
+
</itemmetadata>
|
28
|
+
<presentation>
|
29
|
+
<material>
|
30
|
+
<mattext texttype="text/html"><div><p>QQ1.presision ss</p></div></mattext>
|
31
|
+
</material>
|
32
|
+
<response_str ident="response1" rcardinality="Single">
|
33
|
+
<render_fib fibtype="Decimal">
|
34
|
+
<response_label ident="answer1"/>
|
35
|
+
</render_fib>
|
36
|
+
</response_str>
|
37
|
+
</presentation>
|
38
|
+
<resprocessing>
|
39
|
+
<outcomes>
|
40
|
+
<decvar maxvalue="100" minvalue="0" varname="SCORE" vartype="Decimal"/>
|
41
|
+
</outcomes>
|
42
|
+
<respcondition continue="No">
|
43
|
+
<conditionvar>
|
44
|
+
<or>
|
45
|
+
<varequal respident="response1" precisiontype="decimals" precision="4">100.1234</varequal>
|
46
|
+
<and>
|
47
|
+
<vargt respident="response1">999.995</vargt>
|
48
|
+
<varlte respident="response1">1000.005</varlte>
|
49
|
+
</and>
|
50
|
+
</or>
|
51
|
+
</conditionvar>
|
52
|
+
<setvar action="Set" varname="SCORE">100</setvar>
|
53
|
+
</respcondition>
|
54
|
+
</resprocessing>
|
55
|
+
</item>
|
56
|
+
</section>
|
57
|
+
</assessment>
|
58
|
+
</questestinterop>
|
@@ -65,6 +65,21 @@ describe Qti::V1::Models::Interactions::NumericInteraction do
|
|
65
65
|
expect(loaded_class.item_body).to eq '<div><p>QQ1.margin error</p></div>'
|
66
66
|
end
|
67
67
|
end
|
68
|
+
|
69
|
+
context 'with explicit margin and margin_type' do
|
70
|
+
let(:xml_file_name) { 'numeric_margin_error_percent.xml' }
|
71
|
+
context 'the first item in numeric_margin_error.xml' do
|
72
|
+
let(:loaded_class) { described_class.new(assessment_item_refs.first, test_object) }
|
73
|
+
let(:answer_count) { 1 }
|
74
|
+
|
75
|
+
include_examples 'scoring_data_structs',
|
76
|
+
id: %w[response1],
|
77
|
+
type: %w[marginOfError],
|
78
|
+
value: %w[200.0],
|
79
|
+
margin: %w[20.0],
|
80
|
+
margin_type: %w[percent]
|
81
|
+
end
|
82
|
+
end
|
68
83
|
end
|
69
84
|
|
70
85
|
context 'precision' do
|
@@ -87,6 +102,22 @@ describe Qti::V1::Models::Interactions::NumericInteraction do
|
|
87
102
|
expect(loaded_class.item_body).to eq '<div><p>QQ1.presision ss</p></div>'
|
88
103
|
end
|
89
104
|
end
|
105
|
+
|
106
|
+
context 'with explicit precision and precision_type' do
|
107
|
+
let(:xml_file_name) { 'numeric_precision_decimals.xml' }
|
108
|
+
|
109
|
+
context 'the first item in numeric_precision_decimals.xml' do
|
110
|
+
let(:loaded_class) { described_class.new(assessment_item_refs.first, test_object) }
|
111
|
+
let(:answer_count) { 1 }
|
112
|
+
|
113
|
+
include_examples 'scoring_data_structs',
|
114
|
+
id: %w[response1],
|
115
|
+
type: %w[preciseResponse],
|
116
|
+
value: %w[100.1234],
|
117
|
+
precision: %w[4],
|
118
|
+
precision_type: %w[decimals]
|
119
|
+
end
|
120
|
+
end
|
90
121
|
end
|
91
122
|
|
92
123
|
context 'wthin range' do
|
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.15.
|
4
|
+
version: 2.15.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Diaz
|
@@ -412,7 +412,9 @@ files:
|
|
412
412
|
- spec/fixtures/items_1.2/multiple_choice.xml
|
413
413
|
- spec/fixtures/items_1.2/numeric_exact_match.xml
|
414
414
|
- spec/fixtures/items_1.2/numeric_margin_error.xml
|
415
|
+
- spec/fixtures/items_1.2/numeric_margin_error_percent.xml
|
415
416
|
- spec/fixtures/items_1.2/numeric_precision.xml
|
417
|
+
- spec/fixtures/items_1.2/numeric_precision_decimals.xml
|
416
418
|
- spec/fixtures/items_1.2/numeric_within_range.xml
|
417
419
|
- spec/fixtures/items_1.2/ordering.xml
|
418
420
|
- spec/fixtures/items_1.2/question_group.xml
|
@@ -772,7 +774,9 @@ test_files:
|
|
772
774
|
- spec/fixtures/items_1.2/multiple_choice.xml
|
773
775
|
- spec/fixtures/items_1.2/numeric_exact_match.xml
|
774
776
|
- spec/fixtures/items_1.2/numeric_margin_error.xml
|
777
|
+
- spec/fixtures/items_1.2/numeric_margin_error_percent.xml
|
775
778
|
- spec/fixtures/items_1.2/numeric_precision.xml
|
779
|
+
- spec/fixtures/items_1.2/numeric_precision_decimals.xml
|
776
780
|
- spec/fixtures/items_1.2/numeric_within_range.xml
|
777
781
|
- spec/fixtures/items_1.2/ordering.xml
|
778
782
|
- spec/fixtures/items_1.2/question_group.xml
|