qti 2.23.0 → 2.23.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: e31df9f591cac79f5ac4c2d6ac0901757151e68532ee60cd94599bfd028fd114
4
- data.tar.gz: 29eebbef83f5cbd6e08ba3e556e2fb390995f3794a218d7529c1b27e7b6b2c99
3
+ metadata.gz: 0a3bdd61348e25e10bc6be36542bdac9fc662a5360387f8e987e8340795d377c
4
+ data.tar.gz: 228cf78fd4b6b872b0cb09d5e8309b7939fa166b8b8369fa138280f528fbdf82
5
5
  SHA512:
6
- metadata.gz: '0983e7070edb2d6d6bea9efa4fa7e3daff11a77fdddb9230a13dc71fa7191ca69deba037443fb8a57fb6737c5e609ab383568d07d89f39c1907aa779c2505faa'
7
- data.tar.gz: d3e1041c1ff761a9db545fbe0bca3170d6247cbcb73070c42160c5444e095a7d3f9453bf4da2a9c60ffdeb71fc6f755ce5af7cec4aa4857c551fe78ea0b38ee3
6
+ metadata.gz: 6012a91afe2a875c5086a05b38b1d4d9aff8a24c991e289c20fd4d724a341cf7510180d302e057d28ae8abcda15773505ce9d53dc93fa317b644c2699e55ddfe
7
+ data.tar.gz: c51a879f2bb00dcbbe25d42fc1b5b11464efbe8635b5091bb58d3dee313479a8a734319455ab022080eed81193910fdd3c5de28f4a7dfaac863969a10104d753
@@ -129,7 +129,7 @@ module Qti
129
129
  choice = {
130
130
  id: bnode_id,
131
131
  position: index + 1,
132
- item_body: bnode.at_xpath('.//xmlns:mattext').text
132
+ item_body: bnode.at_xpath('.//xmlns:mattext').inner_html
133
133
  }
134
134
  @blank_choices ||= {}
135
135
  @blank_choices[bnode_id] = choice
@@ -83,7 +83,7 @@ module Qti
83
83
  # rubocop:enable Metrics/AbcSize
84
84
  def setvar_nodes(choice_nodes)
85
85
  choice_nodes.select do |choice_node|
86
- choice_node.at_xpath('.//xmlns:setvar')&.content&.to_f&.positive?
86
+ choice_node.at_xpath('.//xmlns:setvar')&.content&.present?
87
87
  end
88
88
  end
89
89
  end
data/lib/qti/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qti
2
- VERSION = '2.23.0'.freeze
2
+ VERSION = '2.23.2'.freeze
3
3
  end
@@ -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">&lt;p&gt;the correct answer is letter A&lt;/p&gt;</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">0.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">0.0</setvar>
64
+ </respcondition>
65
+ </resprocessing>
66
+ </item>
67
+ </section>
68
+ </assessment>
69
+ </questestinterop>
@@ -80,12 +80,12 @@
80
80
  </response_lid>
81
81
  <response_lid ident="response_a053119f-6a61-4372-ac79-4b2a7de0232f">
82
82
  <material>
83
- <mattext>^orange$</mattext>
83
+ <mattext>^orange&lt;s&gt;$</mattext>
84
84
  </material>
85
85
  <render_choice>
86
86
  <response_label ident="a053119f-6a61-4372-ac79-4b2a7de0232f-0" scoring_algorithm='TextRegex' answer_type='openEntry'>
87
87
  <material>
88
- <mattext texttype="text/plain">^orange$</mattext>
88
+ <mattext texttype="text/plain">^orange&lt;s&gt;$</mattext>
89
89
  </material>
90
90
  </response_label>
91
91
  </render_choice>
@@ -138,7 +138,7 @@ describe Qti::V1::Models::AssessmentItem do
138
138
  describe '#scoring_data_structs' do
139
139
  it 'grabs the rcardinality and scoring data value' do
140
140
  struct = loaded_class.send(:scoring_data_structs)
141
- expect(struct.first.values).to eq 'QUE_1006_A2'
141
+ expect(struct.first.values).to eq 'QUE_1005_A1'
142
142
  expect(struct.first.rcardinality).to eq 'Single'
143
143
  end
144
144
  end
@@ -266,4 +266,26 @@ describe Qti::V1::Models::AssessmentItem do
266
266
  end
267
267
  end
268
268
  end
269
+
270
+ context 'multiple choice with "vary points by answer" and answers with zero points' do
271
+ let(:file_path) { File.join('spec', 'fixtures', 'items_1.2', 'choice_vary_points_by_answer_zero_points.xml') }
272
+ let(:test_object) { Qti::V1::Models::Assessment.from_path!(file_path) }
273
+ let(:assessment_item_refs) { test_object.assessment_items }
274
+ let(:loaded_class) { described_class.new(assessment_item_refs.first) }
275
+
276
+ describe '#scoring_data_structs' do
277
+ it 'collects all the correct answers' do
278
+ struct = loaded_class.scoring_data_structs
279
+ expect(struct.size).to eq 2
280
+ expect(struct.map(&:values)).to eq %w[93bbcb84-3281-4d99-b243-79ba4051e654 3cd6d311-07cd-4ec0-b2db-3048e6cf1128]
281
+ end
282
+
283
+ it 'collect all the points answer points' do
284
+ struct = loaded_class.scoring_data_structs
285
+ expect(struct.size).to eq 2
286
+ expect(struct.map(&:scoring_options)).to eq([{ 'points' => 0.0 },
287
+ { 'points' => 0.0, 'correct_answer' => true }])
288
+ end
289
+ end
290
+ end
269
291
  end
@@ -243,7 +243,7 @@ describe Qti::V1::Models::Interactions::FillBlankInteraction do
243
243
  41dfd716-8fd9-466a-97fa-33d353e44b42-1
244
244
  a053119f-6a61-4372-ac79-4b2a7de0232f-0]
245
245
  end
246
- let(:scoring_data_values) { %w[red blue green yellow teal ^orange$] }
246
+ let(:scoring_data_values) { %w[red blue green yellow teal ^orange<s>$] }
247
247
  let(:scoring_data_case) { %w[no no no no no no] }
248
248
  let(:scoring_data_algorithm) do
249
249
  %w[TextContainsAnswer TextCloseEnough TextEquivalence TextInChoices TextInChoices TextRegex]
@@ -284,7 +284,7 @@ describe Qti::V1::Models::Interactions::FillBlankInteraction do
284
284
  type: 'blank' },
285
285
  { id: 'stem_8', position: 9, type: 'text', value: ', and ' },
286
286
  { blank_id: 'response_a053119f-6a61-4372-ac79-4b2a7de0232f',
287
- blank_name: '^orange$',
287
+ blank_name: '^orange&lt;s&gt;$',
288
288
  id: 'stem_9',
289
289
  position: 10,
290
290
  type: 'blank' },
data/spec/lib/qti_spec.rb CHANGED
@@ -35,7 +35,7 @@ describe Qti::Importer do
35
35
  assessment_items = importer.assessment_item_refs.map { |item| importer.create_assessment_item(item) }
36
36
  expect(assessment_items.count).to eq 5
37
37
  answer_arity = assessment_items.map { |item| item.scoring_data_structs.count }
38
- expect(answer_arity).to eq [1, 1, 4, 1, 1]
38
+ expect(answer_arity).to eq [2, 5, 7, 1, 1]
39
39
  end
40
40
 
41
41
  it 'sets the path and package root properly' 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.23.0
4
+ version: 2.23.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: 2024-05-23 00:00:00.000000000 Z
15
+ date: 2024-07-15 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: actionview
@@ -403,6 +403,7 @@ files:
403
403
  - spec/fixtures/items_1.2/categorization.xml
404
404
  - spec/fixtures/items_1.2/choice.xml
405
405
  - spec/fixtures/items_1.2/choice_vary_points_by_answer.xml
406
+ - spec/fixtures/items_1.2/choice_vary_points_by_answer_zero_points.xml
406
407
  - spec/fixtures/items_1.2/essay.xml
407
408
  - spec/fixtures/items_1.2/essay_custom_settings.xml
408
409
  - spec/fixtures/items_1.2/fib.xml
@@ -783,6 +784,7 @@ test_files:
783
784
  - spec/fixtures/items_1.2/categorization.xml
784
785
  - spec/fixtures/items_1.2/choice.xml
785
786
  - spec/fixtures/items_1.2/choice_vary_points_by_answer.xml
787
+ - spec/fixtures/items_1.2/choice_vary_points_by_answer_zero_points.xml
786
788
  - spec/fixtures/items_1.2/essay.xml
787
789
  - spec/fixtures/items_1.2/essay_custom_settings.xml
788
790
  - spec/fixtures/items_1.2/fib.xml