canvas_cc 0.0.17 → 0.0.18
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/canvas_cc/canvas_cc/models/canvas_module.rb +3 -1
- data/lib/canvas_cc/canvas_cc/models/module_completion_requirement.rb +8 -0
- data/lib/canvas_cc/canvas_cc/module_meta_writer.rb +14 -0
- data/lib/canvas_cc/version.rb +1 -1
- data/lib/canvas_cc.rb +1 -0
- data/spec/moodle2cc/canvas_cc/module_meta_writer_spec.rb +19 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84dbde3ea8923f460728ccf8db29d172dbf4fde7
|
4
|
+
data.tar.gz: 7b90bdbf97bc575b3f91af3f4b84540c56485b8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac377db5dd73f9a3d06ef6f9e4d0845fb9c69de570643ace170f221c88a8efa1fbe89168955f1626ede79def212c4114c6fd75677ce86592f4cf0b05520e0a85
|
7
|
+
data.tar.gz: 6e9f1b2cd51d873339637cf5923da402cd6a3f90e99b467333e3b73b10ad87150814cce3f1d77616c2440618799c7e6832befd4c54052bb65fc14a6136d38da9
|
data/Gemfile.lock
CHANGED
@@ -2,11 +2,13 @@ module CanvasCc::CanvasCC::Models
|
|
2
2
|
class CanvasModule
|
3
3
|
|
4
4
|
attr_accessor :identifier, :title, :workflow_state, :module_items,
|
5
|
-
:unlock_at, :start_at, :end_at, :require_sequential_progress,
|
5
|
+
:unlock_at, :start_at, :end_at, :require_sequential_progress,
|
6
|
+
:prerequisites, :completion_requirements
|
6
7
|
|
7
8
|
def initialize
|
8
9
|
@module_items = []
|
9
10
|
@prerequisites = []
|
11
|
+
@completion_requirements = []
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
@@ -37,6 +37,10 @@ module CanvasCc::CanvasCC
|
|
37
37
|
xml.prerequisites { |xml|
|
38
38
|
add_prerequisites_to_xml(mod.prerequisites, xml)
|
39
39
|
}
|
40
|
+
|
41
|
+
xml.completionRequirements {|xml|
|
42
|
+
add_completion_requirements_to_xml(mod.completion_requirements, xml)
|
43
|
+
}
|
40
44
|
}
|
41
45
|
end
|
42
46
|
|
@@ -64,5 +68,15 @@ module CanvasCc::CanvasCC
|
|
64
68
|
end
|
65
69
|
end
|
66
70
|
|
71
|
+
def add_completion_requirements_to_xml(completion_requirements, xml)
|
72
|
+
completion_requirements.each do |comp_req|
|
73
|
+
xml.completionRequirement('type' => comp_req.type){|xml|
|
74
|
+
xml.identifierref comp_req.identifierref
|
75
|
+
xml.min_score comp_req.min_score
|
76
|
+
xml.max_score comp_req.max_score
|
77
|
+
}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
67
81
|
end
|
68
82
|
end
|
data/lib/canvas_cc/version.rb
CHANGED
data/lib/canvas_cc.rb
CHANGED
@@ -94,6 +94,7 @@ module CanvasCc
|
|
94
94
|
autoload :WorkflowState, 'canvas_cc/canvas_cc/models/workflow_state'
|
95
95
|
autoload :Range, 'canvas_cc/canvas_cc/models/range'
|
96
96
|
autoload :ModulePrerequisite, 'canvas_cc/canvas_cc/models/module_prerequisite'
|
97
|
+
autoload :ModuleCompletionRequirement, 'canvas_cc/canvas_cc/models/module_completion_requirement'
|
97
98
|
end
|
98
99
|
end
|
99
100
|
end
|
@@ -6,6 +6,7 @@ module CanvasCc::CanvasCC
|
|
6
6
|
let(:canvas_module) { Models::CanvasModule.new }
|
7
7
|
let(:module_item) { Models::ModuleItem.new }
|
8
8
|
let(:module_prerequisite) {Models::ModulePrerequisite.new}
|
9
|
+
let(:module_completion_req) {Models::ModuleCompletionRequirement.new}
|
9
10
|
let(:tmpdir) { Dir.mktmpdir }
|
10
11
|
|
11
12
|
before :each do
|
@@ -70,6 +71,24 @@ module CanvasCc::CanvasCC
|
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
74
|
+
context 'completion requirements' do
|
75
|
+
it 'writes completion requirements' do
|
76
|
+
canvas_module.identifier = 'module_identifier'
|
77
|
+
module_completion_req.type = Models::ModuleCompletionRequirement::CONTENT_TYPE_MIN_SCORE
|
78
|
+
module_completion_req.min_score = 1
|
79
|
+
module_completion_req.max_score = 5
|
80
|
+
module_completion_req.identifierref = canvas_module.identifier
|
81
|
+
canvas_module.completion_requirements << module_completion_req
|
82
|
+
xml = write_xml(canvas_module)
|
83
|
+
comp_node = xml.%('modules/module/completionRequirements/completionRequirement')
|
84
|
+
expect(comp_node.at_xpath('@type').text).to eq(Models::ModuleCompletionRequirement::CONTENT_TYPE_MIN_SCORE)
|
85
|
+
expect(comp_node.%('min_score').text).to eq('1')
|
86
|
+
expect(comp_node.%('max_score').text).to eq('5')
|
87
|
+
expect(comp_node.%('identifierref').text).to eq(canvas_module.identifier)
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
73
92
|
context 'module items' do
|
74
93
|
it 'writes out module items correctly' do
|
75
94
|
module_item.identifier = "some_unique_hash"
|
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.
|
4
|
+
version: 0.0.18
|
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
|
+
date: 2015-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -276,6 +276,7 @@ files:
|
|
276
276
|
- lib/canvas_cc/canvas_cc/models/discussion.rb
|
277
277
|
- lib/canvas_cc/canvas_cc/models/discussion_topic.rb
|
278
278
|
- lib/canvas_cc/canvas_cc/models/matching_question.rb
|
279
|
+
- lib/canvas_cc/canvas_cc/models/module_completion_requirement.rb
|
279
280
|
- lib/canvas_cc/canvas_cc/models/module_item.rb
|
280
281
|
- lib/canvas_cc/canvas_cc/models/module_prerequisite.rb
|
281
282
|
- lib/canvas_cc/canvas_cc/models/multiple_dropdowns_question.rb
|