canvas_cc 0.0.28 → 0.0.29

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: 3a8a64dd671c54241f7d1051eb176a106f2937f3
4
- data.tar.gz: 74ee921f395af8bc0b813a24aa4a98c03cf5c2dc
3
+ metadata.gz: 04a69e817a8540a1b6003ef78575b22a5f90b87d
4
+ data.tar.gz: 9c10344ff162635071a8e8d78385a5079b25f54a
5
5
  SHA512:
6
- metadata.gz: 1686311c4077fb06f9311d4965bf77915bb323c0a1f761aa2c5b083083b0ba39ed13aacfcfd0c4b87839e458e5e0c4e5a4a93917aeabc82de2c8047f84d72421
7
- data.tar.gz: c6159917b40b05111da1c66397bf315f5620c798adea0897f40853e3556846782387e7b2d028826005e9886c142f15916b5d893e28283c073c444c87f6984e13
6
+ metadata.gz: b35927038a9025e63f8097534ed6adeac57347b072dcfff5e61dc048e04ad9f98c7e2437b1c0dac37627f75e79170ac995307bfa81368cab3f7c2d8f7a6f0ece
7
+ data.tar.gz: ae145d3b4587e17730f63055720fb18ae341af4618f344a491e1794c441e181d6c772008acf2c0779fc150c3a58009ace92e1bf4156e33a5dbbdcf2ba589ffa9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- canvas_cc (0.0.24)
4
+ canvas_cc (0.0.25)
5
5
  builder
6
6
  happymapper
7
7
  nokogiri
@@ -87,8 +87,6 @@ DEPENDENCIES
87
87
  guard-minitest
88
88
  guard-rspec
89
89
  minitest
90
+ pry
90
91
  rake
91
92
  rspec (~> 2)
92
-
93
- BUNDLED WITH
94
- 1.10.5
data/canvas_cc.gemspec CHANGED
@@ -33,5 +33,6 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "guard-minitest"
34
34
  spec.add_development_dependency "guard-rspec"
35
35
  spec.add_development_dependency "byebug"
36
+ spec.add_development_dependency "pry"
36
37
  spec.add_development_dependency "bundler", "~> 1.5"
37
38
  end
@@ -24,7 +24,17 @@ module CanvasCc::CanvasCC
24
24
  end
25
25
 
26
26
  def self.write_response_conditions(processing_node, question)
27
- # this is always an answerless questionnaire question (for now), so no response conditions are necessary
27
+ weight = 100.to_f/question.responses.count
28
+ question.responses.each do |response|
29
+ correct_choice = response[:choices].find{|c| c[:answer] == true}
30
+ next unless (correct_choice && !correct_choice.empty?)
31
+ processing_node.respcondition do |condition_node|
32
+ condition_node.conditionvar do |var_node|
33
+ var_node.varequal correct_choice[:id], :respident => "response_#{response[:id]}"
34
+ end
35
+ condition_node.setvar "%.2f" % weight, :varname => 'SCORE', :action => 'Add'
36
+ end
37
+ end
28
38
  end
29
39
  end
30
- end
40
+ end
@@ -1,3 +1,3 @@
1
1
  module CanvasCc
2
- VERSION = "0.0.28"
2
+ VERSION = "0.0.29"
3
3
  end
@@ -14,10 +14,10 @@ module CanvasCc::CanvasCC
14
14
  question.responses = [
15
15
  {:id => "response1", :choices => [
16
16
  {:id => "3_choice_0_0", :text => "1"},
17
- {:id => "3_choice_0_1", :text => "2"}
17
+ {:id => "3_choice_0_1", :text => "2", :answer => true}
18
18
  ]},
19
19
  {:id => "response2", :choices => [
20
- {:id => "3_choice_1_0", :text => "1"},
20
+ {:id => "3_choice_1_0", :text => "1", :answer => true},
21
21
  {:id => "3_choice_1_1", :text => "2"}
22
22
  ]}
23
23
  ]
@@ -41,6 +41,10 @@ module CanvasCc::CanvasCC
41
41
  expect(response.attributes['ident'].value).to eq 'response_response2'
42
42
  expect(response.at_xpath("render_choice/response_label[@ident=\"3_choice_1_0\"]/material/mattext[@texttype=\"text/plain\" and text()=\"1\"]")).not_to be_nil
43
43
  expect(response.at_xpath("render_choice/response_label[@ident=\"3_choice_1_1\"]/material/mattext[@texttype=\"text/plain\" and text()=\"2\"]")).not_to be_nil
44
+
45
+ expect(xml.xpath('item/resprocessing/respcondition').count).to eq(3)
46
+ expect(xml.xpath("item/resprocessing/respcondition/conditionvar/varequal[@respident=\"response_response1\"]").text).to eq("3_choice_0_1")
47
+ expect(xml.xpath("item/resprocessing/respcondition/conditionvar/varequal[@respident=\"response_response2\"]").text).to eq("3_choice_1_0")
44
48
  end
45
49
  end
46
- end
50
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.28
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-30 00:00:00.000000000 Z
11
+ date: 2015-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: pry
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: bundler
211
225
  requirement: !ruby/object:Gem::Requirement
@@ -435,7 +449,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
435
449
  version: '0'
436
450
  requirements: []
437
451
  rubyforge_project:
438
- rubygems_version: 2.4.3
452
+ rubygems_version: 2.4.5
439
453
  signing_key:
440
454
  specification_version: 4
441
455
  summary: Create Canvas CC compatible file
@@ -527,4 +541,3 @@ test_files:
527
541
  - test/unit/logger_test.rb
528
542
  - test/unit/migrator_test.rb
529
543
  - test/unit/resource_factory_test.rb
530
- has_rdoc: