qti 0.2.9 → 0.2.10

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
  SHA1:
3
- metadata.gz: f8b9abebcb7232e927515c0894e9edbd8d2bf2a7
4
- data.tar.gz: 50f4b9e76ebdb5a32decf0abcb14cf0c753b0d37
3
+ metadata.gz: a99a295b321477ec278d05a62c1368168ee71be7
4
+ data.tar.gz: 49e3138a5434ffd9cab0de32419a9a97188d84cd
5
5
  SHA512:
6
- metadata.gz: bb4ca859a429202fc4817201d41556db3c6302175b5a09ae31a3dac8bcc77af4b18472281b7b6dbce6735ec8898d74436d1f38c445553e614e72901ec3f0eb6d
7
- data.tar.gz: 15f96e0ecab7bf5904e532d01f2858438dced5564d85a9333c53f9fed34a9c0145a98df52907a23ee6109220d35b683322bd84b0e93e4f2c807115392734349b
6
+ metadata.gz: 84401d7e4405b17df70516aada5e2f16bd76bc9f7ca5a5fe64f51f4865f53f2f6a526c63d444c3b0cba33e2c8bc2f5f1a1b0689081dadcbadcf773acf4597028
7
+ data.tar.gz: 931f6230b1fa7eb9ecaecfff95380bb15570ccf7011f7e0f03fd39b4820719f04060c8288962244b8316d0e708820c09b9f4420a877cc75cff561c51dfa04dbd
@@ -51,14 +51,18 @@ module Qti
51
51
  if ordering?
52
52
  scoring_data_structs_for_ordering
53
53
  else
54
- choice_nodes = doc.xpath('//respcondition')
55
- choice_nodes.select { |choice_node| choice_node.at_xpath('.//setvar').content.to_f.positive? }
56
- .map { |value_node| ScoringData.new(value_node.at_xpath('//varequal').content, rcardinality) }
54
+ default_scoring_data_structs
57
55
  end
58
56
  end
59
57
 
60
58
  private
61
59
 
60
+ def default_scoring_data_structs
61
+ choice_nodes = doc.xpath('.//respcondition')
62
+ choice_nodes.select { |choice_node| choice_node.at_xpath('.//setvar').content.to_f.positive? }
63
+ .map { |value_node| ScoringData.new(value_node.at_xpath('.//varequal').content, rcardinality) }
64
+ end
65
+
62
66
  def scoring_data_structs_for_ordering
63
67
  @doc.xpath('//conditionvar/varequal').map do |value_node|
64
68
  ScoringData.new(value_node.content, rcardinality)
@@ -15,7 +15,7 @@ module Qti
15
15
  result << match if match
16
16
  end
17
17
 
18
- raise V1::UnsupportedSchema if matches.size > 1
18
+ raise UnsupportedSchema if matches.size > 1
19
19
 
20
20
  matches.first
21
21
  end
@@ -5,7 +5,7 @@ module Qti
5
5
  class LogicalIdentifierInteraction < Qti::V1::Models::Base
6
6
  # This will know if a class matches
7
7
  def self.matches(node)
8
- match = node.at_xpath('//response_lid')
8
+ match = node.at_xpath('.//response_lid')
9
9
  return false unless match.present?
10
10
  new(match)
11
11
  end
@@ -29,7 +29,7 @@ describe Qti::V1::Models::AssessmentItem do
29
29
  describe '#scoring_data_structs' do
30
30
  it 'grabs the rcardinality and scoring data value' do
31
31
  struct = loaded_class.send(:scoring_data_structs)
32
- expect(struct.first.values).to eq 'QUE_1005_A1'
32
+ expect(struct.first.values).to eq 'QUE_1006_A2'
33
33
  expect(struct.first.rcardinality).to eq 'Single'
34
34
  end
35
35
 
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Qti::Importer do
4
-
5
4
  let(:fixtures_path) { File.join('spec', 'fixtures') }
6
5
  let(:importer) { Qti::Importer.new(file_path) }
7
6
  let(:manifest_path) { File.join(file_path, 'imsmanifest.xml') }
@@ -26,6 +25,16 @@ describe Qti::Importer do
26
25
 
27
26
  include_examples 'initialize'
28
27
  include_examples 'unsupported QTI version'
28
+
29
+ describe '#create_assessment_item' do
30
+ it 'create items with correct scoring structs' do
31
+ assessment = importer.test_object
32
+ assessment_items = importer.assessment_item_refs.map{ |ref| importer.create_assessment_item(ref) }
33
+ expect(assessment_items.count).to eq 3
34
+ answer_arity = assessment_items.map{|item| item.scoring_data_structs.count }
35
+ expect(answer_arity).to eq [1, 1, 4]
36
+ end
37
+ end
29
38
  end
30
39
 
31
40
  context 'QTI 2.1' 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: 0.2.9
4
+ version: 0.2.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: 2017-03-23 00:00:00.000000000 Z
12
+ date: 2017-03-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport