qti 2.20.0 → 2.20.2

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: 1c38dab5972627b0bf1cd428bbde63a1363365dab50bf9726f6b8a35aa605a2a
4
- data.tar.gz: b00506a2ada125d8853f42fa7b5d328b68985b9821be063e5371a03f6333ef90
3
+ metadata.gz: da80b152cde2c888a430bbada6c10bcf17014051966422051fe8b03f72289d37
4
+ data.tar.gz: 7dae249fdedc88b62ed6446530ff8c7b4571aa92b7b2e7971d0b17387f1a64e6
5
5
  SHA512:
6
- metadata.gz: a4ac85f4bc7890cf07b860b9ddeb8874298dd18fc04136c3d5432e4e0513ec07fb15971657f08ef120ffa8040c1361d3d48b4a45457cb261415a8e1ce9b49358
7
- data.tar.gz: b2445a01bdeb590a23f2f89a050215b4b19290a436d2d49ea14d1d52a2c6be2b9c486e85095d68153ca5ace4c894d3a1524276d0189ccaae4024fffe2a1c5dad
6
+ metadata.gz: 1e675715605ea756267eb2366ad0a1c77d118323cd6a01e9a997d1a2a46081e2cce5f18869aaaf60887cc82f496994730e74001520aee83f4708fad97d3570ed
7
+ data.tar.gz: 106e313ebc91bcfcea283c7d1977044ff349e2ec6c0b67eb9e113a95805a9fff5f7c4c8b95651526ff8dd49a9fa23057b00e10dc0c2c018fa9dbcdba49a32c56
@@ -1,5 +1,6 @@
1
1
  module Qti
2
2
  module Models
3
+ # rubocop:disable Metrics/ClassLength
3
4
  class AssessmentMeta < Qti::Models::Base
4
5
  def title
5
6
  sanitize_content!(tag_under_quiz('title'))
@@ -9,6 +10,14 @@ module Qti
9
10
  sanitize_content!(tag_under_quiz('description'))
10
11
  end
11
12
 
13
+ def shuffle_questions
14
+ tag_under_quiz('shuffle_questions')
15
+ end
16
+
17
+ def shuffle_questions?
18
+ string_true?(shuffle_questions)
19
+ end
20
+
12
21
  def shuffle_answers
13
22
  tag_under_quiz('shuffle_answers')
14
23
  end
@@ -17,6 +26,10 @@ module Qti
17
26
  string_true?(shuffle_answers)
18
27
  end
19
28
 
29
+ def calculator_type
30
+ tag_under_quiz('calculator_type')
31
+ end
32
+
20
33
  def hide_results
21
34
  tag_under_quiz('hide_results')
22
35
  end
@@ -25,6 +38,14 @@ module Qti
25
38
  tag_under_quiz('scoring_policy')
26
39
  end
27
40
 
41
+ def cooling_period_seconds_raw
42
+ tag_under_quiz('cooling_period_seconds')
43
+ end
44
+
45
+ def cooling_period_seconds
46
+ cooling_period_seconds_raw&.to_i
47
+ end
48
+
28
49
  def quiz_type
29
50
  tag_under_quiz('quiz_type')
30
51
  end
@@ -168,6 +189,14 @@ module Qti
168
189
  tag_under_quiz('hide_correct_answers_at')
169
190
  end
170
191
 
192
+ def allow_clear_mc_selection
193
+ tag_under_quiz('allow_clear_mc_selection')
194
+ end
195
+
196
+ def allow_clear_mc_selection?
197
+ string_true?(allow_clear_mc_selection)
198
+ end
199
+
171
200
  def require_lockdown_browser
172
201
  tag_under_quiz('require_lockdown_browser')
173
202
  end
@@ -196,6 +225,80 @@ module Qti
196
225
  tag_under_quiz('lockdown_browser_monitor_data')
197
226
  end
198
227
 
228
+ def nq_ip_filters
229
+ @doc.xpath('//xmlns:quiz/xmlns:nq_ip_filter').map do |ip_filter|
230
+ [ip_filter.attributes['from']&.value, ip_filter.attributes['to']&.value]
231
+ end
232
+ end
233
+
234
+ def nq_ip_filters_enabled?
235
+ nq_ip_filters.any?
236
+ end
237
+
238
+ def result_view_restricted
239
+ tag_under_quiz('result_view_restricted')
240
+ end
241
+
242
+ def result_view_restricted?
243
+ string_true?(result_view_restricted)
244
+ end
245
+
246
+ def display_items
247
+ tag_under_quiz('display_items')
248
+ end
249
+
250
+ def display_items?
251
+ string_true?(display_items)
252
+ end
253
+
254
+ def display_item_feedback
255
+ tag_under_quiz('display_item_feedback')
256
+ end
257
+
258
+ def display_item_feedback?
259
+ string_true?(display_item_feedback)
260
+ end
261
+
262
+ def display_item_response
263
+ tag_under_quiz('display_item_response')
264
+ end
265
+
266
+ def display_item_response?
267
+ string_true?(display_item_response)
268
+ end
269
+
270
+ def display_points_awarded
271
+ tag_under_quiz('display_points_awarded')
272
+ end
273
+
274
+ def display_points_awarded?
275
+ string_true?(display_points_awarded)
276
+ end
277
+
278
+ def display_points_possible
279
+ tag_under_quiz('display_points_possible')
280
+ end
281
+
282
+ def display_points_possible?
283
+ string_true?(display_points_possible)
284
+ end
285
+
286
+ def display_item_correct_answer
287
+ tag_under_quiz('display_item_correct_answer')
288
+ end
289
+
290
+ def display_item_correct_answer?
291
+ string_true?(display_item_correct_answer)
292
+ end
293
+
294
+ def display_item_response_correctness
295
+ tag_under_quiz('display_item_response_correctness')
296
+ end
297
+
298
+ def display_item_response_correctness?
299
+ string_true?(display_item_response_correctness)
300
+ end
301
+
199
302
  private
200
303
 
201
304
  def tag_under_quiz(tag)
@@ -209,10 +312,12 @@ module Qti
209
312
  value&.casecmp('true')&.zero? || false
210
313
  end
211
314
  end
315
+ # rubocop:enable Metrics/ClassLength
212
316
 
213
317
  module AssessmentMetaBase
214
- delegate :title, :description,
215
- :shuffle_answers?, :scoring_policy, :points_possible,
318
+ delegate :title, :description, :shuffle_questions?,
319
+ :shuffle_answers?, :calculator_type, :scoring_policy,
320
+ :cooling_period_seconds, :points_possible,
216
321
  :hide_results, :quiz_type, :anonymous_submissions?,
217
322
  :could_be_locked?, :allowed_attempts, :one_question_at_a_time?,
218
323
  :cant_go_back?, :available?, :one_time_results?,
@@ -222,7 +327,11 @@ module Qti
222
327
  :lock_at, :unlock_at, :due_at, :require_lockdown_browser?,
223
328
  :require_lockdown_browser_for_results?,
224
329
  :require_lockdown_browser_monitor?, :show_correct_answers?,
225
- :lockdown_browser_monitor_data,
330
+ :allow_clear_mc_selection?, :lockdown_browser_monitor_data,
331
+ :nq_ip_filters, :nq_ip_filters_enabled?,
332
+ :result_view_restricted?, :display_items?, :display_item_feedback?,
333
+ :display_item_response?, :display_points_awarded?, :display_points_possible?,
334
+ :display_item_correct_answer?, :display_item_response_correctness?,
226
335
  to: :@canvas_meta_data, prefix: :canvas, allow_nil: true
227
336
 
228
337
  alias canvas_instructions canvas_description
@@ -22,9 +22,11 @@ module Qti
22
22
 
23
23
  def solutions
24
24
  node.xpath('.//xmlns:var_set').map do |anode|
25
+ output = anode.at_xpath('.//xmlns:answer')&.text
26
+
25
27
  {
26
28
  inputs: vars_at_node(anode),
27
- output: anode.at_xpath('.//xmlns:answer')&.text&.to_f
29
+ output: formula_scientific_notation ? output : output&.to_f
28
30
  }
29
31
  end
30
32
  end
@@ -49,6 +51,10 @@ module Qti
49
51
  @node.at_xpath('.//xmlns:formulas/@decimal_places')&.value
50
52
  end
51
53
 
54
+ def formula_scientific_notation
55
+ @node.at_xpath('.//xmlns:formulas/@scientific_notation')&.value == 'true'
56
+ end
57
+
52
58
  def formulas
53
59
  node.xpath('.//xmlns:formula').map(&:text)
54
60
  end
data/lib/qti/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qti
2
- VERSION = '2.20.0'.freeze
2
+ VERSION = '2.20.2'.freeze
3
3
  end
@@ -0,0 +1,74 @@
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
+ <item ident="id39adb107fd2d03971a2d4206c6550dc" title="Formula">
4
+ <itemmetadata>
5
+ <qtimetadata>
6
+ <qtimetadatafield>
7
+ <fieldlabel>question_type</fieldlabel>
8
+ <fieldentry>calculated_question</fieldentry>
9
+ </qtimetadatafield>
10
+ <qtimetadatafield>
11
+ <fieldlabel>points_possible</fieldlabel>
12
+ <fieldentry>1.0</fieldentry>
13
+ </qtimetadatafield>
14
+ <qtimetadatafield>
15
+ <fieldlabel>assessment_question_identifierref</fieldlabel>
16
+ <fieldentry>i2c64259a331bc821bdcb2f326cf36631</fieldentry>
17
+ </qtimetadatafield>
18
+ </qtimetadata>
19
+ </itemmetadata>
20
+ <presentation>
21
+ <material>
22
+ <mattext texttype="text/html">&lt;div&gt;&lt;p&gt;What number is [x]&lt;/p&gt;&lt;/div&gt;</mattext>
23
+ </material>
24
+ <response_str ident="response1" rcardinality="Single">
25
+ <render_fib fibtype="Decimal">
26
+ <response_label ident="answer1"/>
27
+ </render_fib>
28
+ </response_str>
29
+ </presentation>
30
+ <resprocessing>
31
+ <outcomes>
32
+ <decvar maxvalue="100" minvalue="0" varname="SCORE" vartype="Decimal"/>
33
+ </outcomes>
34
+ <respcondition title="correct">
35
+ <conditionvar>
36
+ <other/>
37
+ </conditionvar>
38
+ <setvar varname="SCORE" action="Set">100</setvar>
39
+ </respcondition>
40
+ <respcondition title="incorrect">
41
+ <conditionvar>
42
+ <not>
43
+ <other/>
44
+ </not>
45
+ </conditionvar>
46
+ <setvar varname="SCORE" action="Set">0</setvar>
47
+ </respcondition>
48
+ </resprocessing>
49
+ <itemproc_extension>
50
+ <calculated>
51
+ <answer_tolerance margin_type="">0</answer_tolerance>
52
+ <formulas decimal_places="0" scientific_notation="true">
53
+ <formula>5+x</formula>
54
+ </formulas>
55
+ <vars>
56
+ <var name="x" scale="0">
57
+ <min>0</min>
58
+ <max>10</max>
59
+ </var>
60
+ </vars>
61
+ <var_sets>
62
+ <var_set ident="7d5006729d5dbc489c374a2cd5f41352">
63
+ <var name="x">9</var>
64
+ <answer>1*10^1</answer>
65
+ </var_set>
66
+ <var_set ident="15f629c4045e838e172b04824caa3893">
67
+ <var name="x">2</var>
68
+ <answer>7*10^0</answer>
69
+ </var_set>
70
+ </var_sets>
71
+ </calculated>
72
+ </itemproc_extension>
73
+ </item>
74
+ </questestinterop>
@@ -5,8 +5,11 @@
5
5
  <lock_at>2020-07-10T04:59:59</lock_at>
6
6
  <unlock_at>2020-04-16T05:00:00</unlock_at>
7
7
  <due_at>2020-05-23T04:59:59</due_at>
8
+ <shuffle_questions>true</shuffle_questions>
8
9
  <shuffle_answers>true</shuffle_answers>
10
+ <calculator_type>basic</calculator_type>
9
11
  <scoring_policy>keep_average</scoring_policy>
12
+ <cooling_period_seconds>86400</cooling_period_seconds>
10
13
  <hide_results></hide_results>
11
14
  <quiz_type>assignment</quiz_type>
12
15
  <points_possible/>
@@ -28,8 +31,19 @@
28
31
  <available>false</available>
29
32
  <one_time_results>false</one_time_results>
30
33
  <show_correct_answers_last_attempt>false</show_correct_answers_last_attempt>
34
+ <allow_clear_mc_selection>true</allow_clear_mc_selection>
31
35
  <only_visible_to_overrides>false</only_visible_to_overrides>
32
36
  <module_locked>false</module_locked>
37
+ <nq_ip_filter from="255.255.0.0" to="255.255.0.255"/>
38
+ <nq_ip_filter from="255.255.0.255" to="255.255.255.255"/>
39
+ <result_view_restricted>true</result_view_restricted>
40
+ <display_items>true</display_items>
41
+ <display_item_feedback>true</display_item_feedback>
42
+ <display_item_response>true</display_item_response>
43
+ <display_points_awarded>true</display_points_awarded>
44
+ <display_points_possible>true</display_points_possible>
45
+ <display_item_correct_answer>true</display_item_correct_answer>
46
+ <display_item_response_correctness>true</display_item_response_correctness>
33
47
  <assignment identifier="g390e22b33353b658bb23abbce000414f">
34
48
  <title>asd09sdfaxsdflj</title>
35
49
  <due_at>2020-05-23T04:59:59</due_at>
@@ -20,7 +20,10 @@ context 'Canvas Assessment Meta Data' do
20
20
  expect(assessment.canvas_available?).to eq(available)
21
21
  expect(assessment.canvas_one_time_results?).to eq(one_time_results)
22
22
  expect(assessment.canvas_scoring_policy).to eq(scoring_policy)
23
+ expect(assessment.canvas_cooling_period_seconds).to eq(cooling_period_seconds)
24
+ expect(assessment.canvas_shuffle_questions?).to eq(shuffle_questions)
23
25
  expect(assessment.canvas_shuffle_answers?).to eq(shuffle_answers)
26
+ expect(assessment.canvas_calculator_type).to eq(calculator_type)
24
27
  expect(assessment.canvas_lock_at).to eq(lock_at)
25
28
  expect(assessment.canvas_unlock_at).to eq(unlock_at)
26
29
  expect(assessment.canvas_due_at).to eq(due_at)
@@ -30,10 +33,21 @@ context 'Canvas Assessment Meta Data' do
30
33
  expect(assessment.canvas_show_correct_answers?).to eq(show_answers)
31
34
  expect(assessment.canvas_show_correct_answers_at).to eq(show_answers_at)
32
35
  expect(assessment.canvas_hide_correct_answers_at).to eq(hide_answers_at)
36
+ expect(assessment.canvas_allow_clear_mc_selection?).to eq(allow_clear_mc_selection)
33
37
  expect(assessment.canvas_require_lockdown_browser?).to eq(rlb)
34
38
  expect(assessment.canvas_require_lockdown_browser_for_results?).to eq(rlb_results)
35
39
  expect(assessment.canvas_require_lockdown_browser_monitor?).to eq(rlb_monitor)
36
40
  expect(assessment.canvas_lockdown_browser_monitor_data).to eq(lb_monitor_data)
41
+ expect(assessment.canvas_nq_ip_filters_enabled?).to eq(nq_ip_filters_enabled)
42
+ expect(assessment.canvas_nq_ip_filters).to eq(nq_ip_filters)
43
+ expect(assessment.canvas_result_view_restricted?).to eq(result_view_restricted)
44
+ expect(assessment.canvas_display_items?).to eq(display_items)
45
+ expect(assessment.canvas_display_item_response?).to eq(display_item_response)
46
+ expect(assessment.canvas_display_item_feedback?).to eq(display_item_feedback)
47
+ expect(assessment.canvas_display_points_awarded?).to eq(display_points_awarded)
48
+ expect(assessment.canvas_display_points_possible?).to eq(display_points_possible)
49
+ expect(assessment.canvas_display_item_correct_answer?).to eq(display_item_correct_answer)
50
+ expect(assessment.canvas_display_item_response_correctness?).to eq(display_item_response_correctness)
37
51
  end
38
52
  end
39
53
 
@@ -53,7 +67,10 @@ context 'Canvas Assessment Meta Data' do
53
67
  let(:available) { true }
54
68
  let(:one_time_results) { false }
55
69
  let(:scoring_policy) { 'keep_highest' }
70
+ let(:cooling_period_seconds) { nil }
71
+ let(:shuffle_questions) { false }
56
72
  let(:shuffle_answers) { false }
73
+ let(:calculator_type) { nil }
57
74
  let(:lock_at) { nil }
58
75
  let(:unlock_at) { nil }
59
76
  let(:due_at) { nil }
@@ -63,10 +80,21 @@ context 'Canvas Assessment Meta Data' do
63
80
  let(:show_answers) { true }
64
81
  let(:show_answers_at) { nil }
65
82
  let(:hide_answers_at) { nil }
83
+ let(:allow_clear_mc_selection) { false }
66
84
  let(:rlb) { false }
67
85
  let(:rlb_results) { false }
68
86
  let(:rlb_monitor) { false }
69
87
  let(:lb_monitor_data) { nil }
88
+ let(:nq_ip_filters_enabled) { false }
89
+ let(:nq_ip_filters) { [] }
90
+ let(:result_view_restricted) { false }
91
+ let(:display_items) { false }
92
+ let(:display_item_response) { false }
93
+ let(:display_item_feedback) { false }
94
+ let(:display_points_awarded) { false }
95
+ let(:display_points_possible) { false }
96
+ let(:display_item_correct_answer) { false }
97
+ let(:display_item_response_correctness) { false }
70
98
 
71
99
  include_examples('loads canvas meta data')
72
100
  end
@@ -87,7 +115,10 @@ context 'Canvas Assessment Meta Data' do
87
115
  let(:available) { false }
88
116
  let(:one_time_results) { false }
89
117
  let(:scoring_policy) { 'keep_average' }
118
+ let(:shuffle_questions) { true }
119
+ let(:cooling_period_seconds) { 86_400 }
90
120
  let(:shuffle_answers) { true }
121
+ let(:calculator_type) { 'basic' }
91
122
  let(:lock_at) { '2020-07-10T04:59:59' }
92
123
  let(:unlock_at) { '2020-04-16T05:00:00' }
93
124
  let(:due_at) { '2020-05-23T04:59:59' }
@@ -97,10 +128,26 @@ context 'Canvas Assessment Meta Data' do
97
128
  let(:show_answers) { true }
98
129
  let(:show_answers_at) { '2041-02-17 06:00:00 UTC' }
99
130
  let(:hide_answers_at) { '2042-12-26 06:00:00 UTC' }
131
+ let(:allow_clear_mc_selection) { true }
100
132
  let(:rlb) { false }
101
133
  let(:rlb_results) { false }
102
134
  let(:rlb_monitor) { false }
103
135
  let(:lb_monitor_data) { nil }
136
+ let(:nq_ip_filters_enabled) { true }
137
+ let(:nq_ip_filters) do
138
+ [
139
+ ['255.255.0.0', '255.255.0.255'],
140
+ ['255.255.0.255', '255.255.255.255']
141
+ ]
142
+ end
143
+ let(:result_view_restricted) { true }
144
+ let(:display_items) { true }
145
+ let(:display_item_response) { true }
146
+ let(:display_item_feedback) { true }
147
+ let(:display_points_awarded) { true }
148
+ let(:display_points_possible) { true }
149
+ let(:display_item_correct_answer) { true }
150
+ let(:display_item_response_correctness) { true }
104
151
 
105
152
  include_examples('loads canvas meta data')
106
153
  end
@@ -121,7 +168,10 @@ context 'Canvas Assessment Meta Data' do
121
168
  let(:available) { false }
122
169
  let(:one_time_results) { false }
123
170
  let(:scoring_policy) { nil }
171
+ let(:cooling_period_seconds) { nil }
172
+ let(:shuffle_questions) { false }
124
173
  let(:shuffle_answers) { false }
174
+ let(:calculator_type) { nil }
125
175
  let(:lock_at) { nil }
126
176
  let(:unlock_at) { nil }
127
177
  let(:due_at) { nil }
@@ -131,10 +181,21 @@ context 'Canvas Assessment Meta Data' do
131
181
  let(:show_answers) { false }
132
182
  let(:show_answers_at) { nil }
133
183
  let(:hide_answers_at) { nil }
184
+ let(:allow_clear_mc_selection) { false }
134
185
  let(:rlb) { false }
135
186
  let(:rlb_results) { false }
136
187
  let(:rlb_monitor) { false }
137
188
  let(:lb_monitor_data) { nil }
189
+ let(:nq_ip_filters_enabled) { false }
190
+ let(:nq_ip_filters) { [] }
191
+ let(:result_view_restricted) { false }
192
+ let(:display_items) { false }
193
+ let(:display_item_response) { false }
194
+ let(:display_item_feedback) { false }
195
+ let(:display_points_awarded) { false }
196
+ let(:display_points_possible) { false }
197
+ let(:display_item_correct_answer) { false }
198
+ let(:display_item_response_correctness) { false }
138
199
 
139
200
  include_examples('loads canvas meta data')
140
201
  end
@@ -155,7 +216,10 @@ context 'Canvas Assessment Meta Data' do
155
216
  let(:available) { true }
156
217
  let(:one_time_results) { false }
157
218
  let(:scoring_policy) { 'keep_highest' }
219
+ let(:cooling_period_seconds) { nil }
220
+ let(:shuffle_questions) { false }
158
221
  let(:shuffle_answers) { false }
222
+ let(:calculator_type) { nil }
159
223
  let(:lock_at) { nil }
160
224
  let(:unlock_at) { nil }
161
225
  let(:due_at) { nil }
@@ -165,10 +229,21 @@ context 'Canvas Assessment Meta Data' do
165
229
  let(:show_answers) { true }
166
230
  let(:show_answers_at) { nil }
167
231
  let(:hide_answers_at) { nil }
232
+ let(:allow_clear_mc_selection) { false }
168
233
  let(:rlb) { false }
169
234
  let(:rlb_results) { false }
170
235
  let(:rlb_monitor) { false }
171
236
  let(:lb_monitor_data) { nil }
237
+ let(:nq_ip_filters_enabled) { false }
238
+ let(:nq_ip_filters) { [] }
239
+ let(:result_view_restricted) { false }
240
+ let(:display_items) { false }
241
+ let(:display_item_response) { false }
242
+ let(:display_item_feedback) { false }
243
+ let(:display_points_awarded) { false }
244
+ let(:display_points_possible) { false }
245
+ let(:display_item_correct_answer) { false }
246
+ let(:display_item_response_correctness) { false }
172
247
 
173
248
  include_examples('loads canvas meta data')
174
249
  end
@@ -13,6 +13,7 @@ describe Qti::V1::Models::Interactions::FormulaInteraction do
13
13
  shared_examples_for 'reading_formulas' do
14
14
  it 'reads formulas correctly' do
15
15
  expect(loaded_class.formula_decimal_places).to eq(formula_decimal_places)
16
+ expect(loaded_class.formula_scientific_notation).to eq(formula_scientific_notation)
16
17
  expect(loaded_class.formulas).to eq(formula_formulas)
17
18
  end
18
19
  end
@@ -41,6 +42,7 @@ describe Qti::V1::Models::Interactions::FormulaInteraction do
41
42
  let(:answer_tolerance) { '0' }
42
43
  let(:margin_of_error) { { margin: '0', margin_type: 'absolute' } }
43
44
  let(:formula_decimal_places) { '0' }
45
+ let(:formula_scientific_notation) { false }
44
46
  let(:formula_formulas) { ['x'] }
45
47
 
46
48
  let(:item_title) { '<div><p>What number is [x]</p></div>' }
@@ -61,6 +63,7 @@ describe Qti::V1::Models::Interactions::FormulaInteraction do
61
63
  let(:answer_tolerance) { '0' }
62
64
  let(:margin_of_error) { { margin: '0', margin_type: 'absolute' } }
63
65
  let(:formula_decimal_places) { '0' }
66
+ let(:formula_scientific_notation) { false }
64
67
  let(:formula_formulas) { ['x+y'] }
65
68
 
66
69
  let(:item_title) { '<div><p>[x] + [y]</p></div>' }
@@ -84,6 +87,7 @@ describe Qti::V1::Models::Interactions::FormulaInteraction do
84
87
  let(:answer_tolerance) { '10%' }
85
88
  let(:margin_of_error) { { margin: '10', margin_type: 'percent' } }
86
89
  let(:formula_decimal_places) { '2' }
90
+ let(:formula_scientific_notation) { false }
87
91
  let(:formula_formulas) { ['x=n*x', 'y=m*y', 'x+y'] }
88
92
 
89
93
  let(:item_title) { '<div><p>[n][x] + [m][y]</p></div>' }
@@ -100,4 +104,26 @@ describe Qti::V1::Models::Interactions::FormulaInteraction do
100
104
  include_examples 'reading_formulas'
101
105
  include_examples 'variables'
102
106
  end
107
+
108
+ context 'Formula with scientific notation' do
109
+ let(:file_path) { File.join(fixtures_path, 'formula_scientific.xml') }
110
+
111
+ let(:scoring_data_values) { ['1*10^1', '7*10^0'] }
112
+
113
+ let(:answer_tolerance) { '0' }
114
+ let(:formula_decimal_places) { '0' }
115
+ let(:formula_scientific_notation) { true }
116
+ let(:formula_formulas) { ['x'] }
117
+ let(:margin_of_error) { { margin: '0', margin_type: 'absolute' } }
118
+ let(:formula_formulas) { ['5+x'] }
119
+
120
+ let(:item_title) { '<div><p>What number is [x]</p></div>' }
121
+
122
+ let(:variables) { [{ max: 10.0, min: 0.0, name: 'x', precision: 0 }] }
123
+
124
+ include_examples 'scoring_data_structs'
125
+ include_examples 'reading_formulas'
126
+ include_examples 'answer_tolerance'
127
+ include_examples 'variables'
128
+ end
103
129
  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.20.0
4
+ version: 2.20.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Diaz
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2023-08-03 00:00:00.000000000 Z
15
+ date: 2023-08-15 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: actionview
@@ -409,6 +409,7 @@ files:
409
409
  - spec/fixtures/items_1.2/formula.xml
410
410
  - spec/fixtures/items_1.2/formula_mform.xml
411
411
  - spec/fixtures/items_1.2/formula_mvar.xml
412
+ - spec/fixtures/items_1.2/formula_scientific.xml
412
413
  - spec/fixtures/items_1.2/hot_spot.xml
413
414
  - spec/fixtures/items_1.2/item_no_title.xml
414
415
  - spec/fixtures/items_1.2/matching.xml
@@ -783,6 +784,7 @@ test_files:
783
784
  - spec/fixtures/items_1.2/formula.xml
784
785
  - spec/fixtures/items_1.2/formula_mform.xml
785
786
  - spec/fixtures/items_1.2/formula_mvar.xml
787
+ - spec/fixtures/items_1.2/formula_scientific.xml
786
788
  - spec/fixtures/items_1.2/hot_spot.xml
787
789
  - spec/fixtures/items_1.2/item_no_title.xml
788
790
  - spec/fixtures/items_1.2/matching.xml