canvas_cc 0.0.34 → 0.0.35

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: 76ab79c64ff69874d3c14515e0ddf91f569ac324
4
- data.tar.gz: c40b18e12c8ce35d13e4580e98e6eb4b9ec695f4
3
+ metadata.gz: 203802c3ba4f0fb8f5dfa69e51ac25771df0f2c7
4
+ data.tar.gz: 9e033c470045609e0abd18cc3d01ee56c88c4a90
5
5
  SHA512:
6
- metadata.gz: 016b64690b99ce4af579d4b01aa7f565870ae8c6e91426ce1e70065e0e921f4f8272ca44d88fafd697105846e8bb4638c25b9a36206f600ce773e96ddd65f1a5
7
- data.tar.gz: e3c22e9a97c7bd1de557d926ac9c44e37267299ee8029b20291e43409b269ab9d57fcd99d17eed775a04688655b1a36cdb405aa595ef05ffaa5978523eab70db
6
+ metadata.gz: 9497a97b9abf7d1268e7701290ecf974344cc6065fcc6b65c2f7bb7185e8f2f81a0661b05a7aec2811b37e60360891c96c039063299ef72496ba6ed9834cde08
7
+ data.tar.gz: bd371cc0b74c154c469d892e4b77e8abd4f90e7e56f76d024380e0be673d48833d86389e9afeaf8ed1b3fd31798ee3b968913b717c7e166500a1739fcd7a950d
@@ -1,10 +1,14 @@
1
1
  module CanvasCc::CanvasCC::Models
2
2
  class Outcome
3
+ DEFAULT_CALCULATION_INT = 65
4
+
3
5
  attr_accessor :identifier, :title, :description, :points_possible, :mastery_points,
4
- :ratings, :is_global_outcome, :ratings, :external_identifier
6
+ :ratings, :is_global_outcome, :ratings, :external_identifier, :calculation_method,
7
+ :calculation_int
5
8
 
6
9
  def initialize
7
10
  @ratings = []
11
+ @calculation_int = DEFAULT_CALCULATION_INT
8
12
  end
9
13
 
10
14
  end
@@ -14,6 +14,8 @@ module CanvasCc::CanvasCC
14
14
  xml.learningOutcome(identifier: outcome.identifier) do
15
15
  xml.title outcome.title
16
16
  xml.description outcome.description
17
+ xml.calculation_method outcome.calculation_method if outcome.calculation_method
18
+ xml.calculation_int(outcome.calculation_int) if outcome.calculation_method == 'decaying_average'
17
19
  xml.points_possible outcome.points_possible
18
20
  xml.mastery_points outcome.mastery_points
19
21
  xml << CanvasCc::CanvasCC::RatingWriter.new(*outcome.ratings).write
@@ -1,3 +1,3 @@
1
1
  module CanvasCc
2
- VERSION = "0.0.34"
2
+ VERSION = "0.0.35"
3
3
  end
@@ -9,4 +9,6 @@ describe CanvasCc::CanvasCC::Models::Outcome do
9
9
  it('has an attribute for ratings') { expect(subject.ratings).to eql [] }
10
10
  it_behaves_like 'it has an attribute for', :is_global_outcome
11
11
  it_behaves_like 'it has an attribute for', :external_identifier
12
+ it_behaves_like 'it has an attribute for', :calculation_method
13
+ it('has an attribute for calculation_int') { expect(subject.calculation_int).to eql 65 }
12
14
  end
@@ -34,6 +34,16 @@ describe CanvasCc::CanvasCC::OutcomeWriter do
34
34
  expect(node.at_xpath('xmlns:points_possible').text).to eql '5'
35
35
  expect(node.at_xpath('xmlns:mastery_points').text).to eql '5'
36
36
  expect(node.at_xpath('xmlns:is_global_outcome').text).to eql 'false'
37
+ expect(node.at_xpath('xmlns:calculation_method')).to eql nil
38
+ expect(node.at_xpath('xmlns:calculation_int')).to eql nil
39
+ end
40
+
41
+ it 'adds calculation_int if calculation_method is set to "decaying_average"' do
42
+ outcome.calculation_method = 'decaying_average'
43
+ xml = write_xml(outcome)
44
+ node = xml.at_xpath('//xmlns:learningOutcomes/xmlns:learningOutcome')
45
+ expect(node.at_xpath('xmlns:calculation_method').text).to eql 'decaying_average'
46
+ expect(node.at_xpath('xmlns:calculation_int').text).to eql '65'
37
47
  end
38
48
 
39
49
  private
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.34
4
+ version: 0.0.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-31 00:00:00.000000000 Z
11
+ date: 2017-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip