qti 1.0.9 → 1.0.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba499677e0990dbf44bf87be25231b89857bb35c
4
- data.tar.gz: b96d68fb28cf9bf91a71d2442caebbfb687bfb4c
3
+ metadata.gz: 6e80bd0f2ab5ede85119a1a1fe1870304667eb5a
4
+ data.tar.gz: e3fb8c1e484263af51cc729ce9253c4b72f180f3
5
5
  SHA512:
6
- metadata.gz: 04a5855e97432a00fd6d5e24200622eaf2b9625201c23129026e99254a250d378c19f668222d2be6a3dec7d8f4ac59ddd061c1acff73cfc9e96eb84712b8ad22
7
- data.tar.gz: 8d31f22322d9e9e441880aa747332cf4e4a8796f1b0ed3cfcc4193ca3b9de9292e90b490048ddd7641d68cd6e717c4554a69b90c531aefb6e1121b2bba867973
6
+ metadata.gz: f0f59f0e09802122d63b6a893cf2bbc83b6c8e9a0afab7874c6b2ae8a508f741149b4bcb9ae6ec69db990a841eb6bde2bc673b48cc35c2620422baeaacff67ab
7
+ data.tar.gz: 732b357b82b3c55e097713b9fffd94355ce46a3cb57bdffdf2036b1e3199fc1b1712acc76487823931266368b54664db8ffa57b8b42b0eb411a356fb85bca61a
@@ -26,6 +26,18 @@ module Qti
26
26
  end
27
27
 
28
28
  def scoring_data_structs
29
+ @scoring_data ||= parse_scoring_data
30
+ end
31
+
32
+ def distractors
33
+ correct = scoring_data_structs[0].values.map(&:second)
34
+ all = answers.map(&:item_body)
35
+ all.reject { |v| correct.include? v }
36
+ end
37
+
38
+ private
39
+
40
+ def parse_scoring_data
29
41
  # This preserves the original behavior while not breaking on itemfeedback
30
42
  path = './/xmlns:respcondition/xmlns:setvar/../xmlns:conditionvar/xmlns:varequal'
31
43
  matches = node.xpath(path).map do |node|
@@ -34,8 +46,6 @@ module Qti
34
46
  [Models::ScoringData.new(Hash[matches], rcardinality)]
35
47
  end
36
48
 
37
- private
38
-
39
49
  def answers_map
40
50
  @answers_map ||= answers.reduce({}) do |acc, answer|
41
51
  acc.update answer.identifier => answer.item_body
@@ -1,3 +1,3 @@
1
1
  module Qti
2
- VERSION = '1.0.9'.freeze
2
+ VERSION = '1.0.10'.freeze
3
3
  end
@@ -26,6 +26,10 @@ describe Qti::V1::Models::Interactions::MatchInteraction do
26
26
  it 'returns the questions' do
27
27
  expect(subject.questions).to eq(expected_questions)
28
28
  end
29
+
30
+ it 'contaons distractors' do
31
+ expect(subject.distractors).to eq(expected_distractors)
32
+ end
29
33
  end
30
34
 
31
35
  shared_examples_for '#scoring_data_structs' do
@@ -55,6 +59,7 @@ describe Qti::V1::Models::Interactions::MatchInteraction do
55
59
  'question_2' => "Uses a beam of electrons. Can provide details of cells' internal structure."
56
60
  }
57
61
  end
62
+ let(:expected_distractors) { ['A distractor answer.'] }
58
63
 
59
64
  include_examples('common features')
60
65
  include_examples('questions and answers')
@@ -80,6 +85,7 @@ describe Qti::V1::Models::Interactions::MatchInteraction do
80
85
  'response_1943' => ''
81
86
  }
82
87
  end
88
+ let(:expected_distractors) { %w[C D E F 3 4 5 6] }
83
89
 
84
90
  include_examples('common features')
85
91
  include_examples('questions and answers')
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: 1.0.9
4
+ version: 1.0.10
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: 2019-02-04 00:00:00.000000000 Z
12
+ date: 2019-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport