canvas_cc 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +91 -0
- data/lib/canvas_cc/canvas_cc/assessment_writer.rb +7 -1
- data/lib/canvas_cc/canvas_cc/models/assessment.rb +10 -5
- data/lib/canvas_cc/version.rb +1 -1
- data/spec/moodle2cc/canvas_cc/assessment_writer_spec.rb +25 -1
- data/spec/moodle2cc/canvas_cc/models/assessment_spec.rb +15 -2
- data/test/tmp/.gitkeep +0 -0
- metadata +5 -3
- data/.gitignore +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 265b94fef90835f9cacbed0bb2b18735ff0a92c9
|
4
|
+
data.tar.gz: 14ded48931133ba06efa51cf756fee1dafd9eaea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 098e7953b9bc2935cd0365429183b11012930d5f65cd838c5b74a818d04455ede9b68f7e8370c524fa7cdc708139658d3b6d79495d54f1eea42efe4bf6e4b732
|
7
|
+
data.tar.gz: 09f6a6b774a80285fa11ceca80b5388ddd37881be1d88de4a7759a5d3aecce1da08fe1cdaee4961163e8b57d639c63e5947723c81c4ecc3354485021c641619b
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
canvas_cc (0.0.6)
|
5
|
+
builder
|
6
|
+
happymapper
|
7
|
+
nokogiri
|
8
|
+
rdiscount
|
9
|
+
rubyzip (>= 1.0.0)
|
10
|
+
thor
|
11
|
+
|
12
|
+
GEM
|
13
|
+
remote: https://rubygems.org/
|
14
|
+
specs:
|
15
|
+
builder (3.2.2)
|
16
|
+
byebug (3.5.1)
|
17
|
+
columnize (~> 0.8)
|
18
|
+
debugger-linecache (~> 1.2)
|
19
|
+
slop (~> 3.6)
|
20
|
+
celluloid (0.15.2)
|
21
|
+
timers (~> 1.1.0)
|
22
|
+
coderay (1.1.0)
|
23
|
+
columnize (0.8.9)
|
24
|
+
debugger-linecache (1.2.0)
|
25
|
+
diff-lcs (1.2.5)
|
26
|
+
ffi (1.9.3)
|
27
|
+
formatador (0.2.5)
|
28
|
+
guard (2.6.1)
|
29
|
+
formatador (>= 0.2.4)
|
30
|
+
listen (~> 2.7)
|
31
|
+
lumberjack (~> 1.0)
|
32
|
+
pry (>= 0.9.12)
|
33
|
+
thor (>= 0.18.1)
|
34
|
+
guard-bundler (2.0.0)
|
35
|
+
bundler (~> 1.0)
|
36
|
+
guard (~> 2.2)
|
37
|
+
guard-minitest (2.3.2)
|
38
|
+
guard (~> 2.0)
|
39
|
+
minitest (>= 3.0)
|
40
|
+
guard-rspec (4.3.1)
|
41
|
+
guard (~> 2.1)
|
42
|
+
rspec (>= 2.14, < 4.0)
|
43
|
+
happymapper (0.4.1)
|
44
|
+
libxml-ruby (~> 2.0)
|
45
|
+
libxml-ruby (2.7.0)
|
46
|
+
listen (2.7.9)
|
47
|
+
celluloid (>= 0.15.2)
|
48
|
+
rb-fsevent (>= 0.9.3)
|
49
|
+
rb-inotify (>= 0.9)
|
50
|
+
lumberjack (1.0.9)
|
51
|
+
method_source (0.8.2)
|
52
|
+
mini_portile (0.6.1)
|
53
|
+
minitest (5.4.1)
|
54
|
+
nokogiri (1.6.4)
|
55
|
+
mini_portile (~> 0.6.0)
|
56
|
+
pry (0.10.1)
|
57
|
+
coderay (~> 1.1.0)
|
58
|
+
method_source (~> 0.8.1)
|
59
|
+
slop (~> 3.4)
|
60
|
+
rake (10.3.2)
|
61
|
+
rb-fsevent (0.9.4)
|
62
|
+
rb-inotify (0.9.5)
|
63
|
+
ffi (>= 0.5.0)
|
64
|
+
rdiscount (2.1.7.1)
|
65
|
+
rspec (2.99.0)
|
66
|
+
rspec-core (~> 2.99.0)
|
67
|
+
rspec-expectations (~> 2.99.0)
|
68
|
+
rspec-mocks (~> 2.99.0)
|
69
|
+
rspec-core (2.99.2)
|
70
|
+
rspec-expectations (2.99.2)
|
71
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
72
|
+
rspec-mocks (2.99.2)
|
73
|
+
rubyzip (1.1.6)
|
74
|
+
slop (3.6.0)
|
75
|
+
thor (0.19.1)
|
76
|
+
timers (1.1.0)
|
77
|
+
|
78
|
+
PLATFORMS
|
79
|
+
ruby
|
80
|
+
|
81
|
+
DEPENDENCIES
|
82
|
+
bundler (~> 1.5)
|
83
|
+
byebug
|
84
|
+
canvas_cc!
|
85
|
+
guard
|
86
|
+
guard-bundler
|
87
|
+
guard-minitest
|
88
|
+
guard-rspec
|
89
|
+
minitest
|
90
|
+
rake
|
91
|
+
rspec (~> 2)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module CanvasCc::CanvasCC
|
2
2
|
class AssessmentWriter
|
3
|
+
include AssignmentHelper
|
3
4
|
|
4
5
|
def initialize(work_dir, *assessments)
|
5
6
|
@work_dir = work_dir
|
@@ -33,6 +34,11 @@ module CanvasCc::CanvasCC
|
|
33
34
|
CanvasCc::CanvasCC::Models::Assessment::DATETIME_ATTRIBUTES.each do |attr|
|
34
35
|
quiz_node.send(attr, CanvasCc::CC::CCHelper.ims_datetime(assessment.send(attr))) unless assessment.send(attr).nil?
|
35
36
|
end
|
37
|
+
unless assessment.assignment.nil?
|
38
|
+
quiz_node.assignment('identifier' => assessment.assignment.assignment_resource.identifier) { |xml|
|
39
|
+
assignment_xml(assessment.assignment, xml)
|
40
|
+
}
|
41
|
+
end
|
36
42
|
end
|
37
43
|
end.to_xml
|
38
44
|
|
@@ -79,4 +85,4 @@ module CanvasCc::CanvasCC
|
|
79
85
|
File.open(file_path, 'w') { |f| f.write(xml) }
|
80
86
|
end
|
81
87
|
end
|
82
|
-
end
|
88
|
+
end
|
@@ -1,14 +1,19 @@
|
|
1
1
|
module CanvasCc::CanvasCC::Models
|
2
2
|
class Assessment
|
3
|
-
META_ATTRIBUTES = [:title, :description, :allowed_attempts,
|
4
|
-
:scoring_policy, :access_code, :ip_filter, :shuffle_answers, :time_limit,
|
5
|
-
|
3
|
+
META_ATTRIBUTES = [:title, :description, :allowed_attempts, :points_possible,
|
4
|
+
:scoring_policy, :access_code, :ip_filter, :shuffle_answers, :time_limit,
|
5
|
+
:quiz_type, :hide_results, :require_lockdown_browser, :require_lockdown_browser_for_results,
|
6
|
+
:require_lockdown_browser_monitor, :lockdown_browser_monitor_data,
|
7
|
+
:show_correct_answers, :anonymous_submissions, :could_be_locked,
|
8
|
+
:available, :allowed_attempts, :one_question_at_a_time, :cant_go_back,
|
9
|
+
:assignment_group_identifierref]
|
10
|
+
DATETIME_ATTRIBUTES = [:lock_at, :unlock_at, :due_at, :show_correct_answers_at]
|
6
11
|
|
7
12
|
ASSESSMENT_TYPE = 'imsqti_xmlv1p2/imscc_xmlv1p1/assessment'
|
8
13
|
LAR_TYPE = 'associatedcontent/imscc_xmlv1p1/learning-application-resource'
|
9
14
|
ASSESSMENT_NON_CC_FOLDER = 'non_cc_assessments'
|
10
15
|
|
11
|
-
attr_accessor :identifier, :workflow_state, :question_references, :items, *META_ATTRIBUTES, *DATETIME_ATTRIBUTES
|
16
|
+
attr_accessor :identifier, :workflow_state, :question_references, :items, :assignment, *META_ATTRIBUTES, *DATETIME_ATTRIBUTES
|
12
17
|
|
13
18
|
def initialize
|
14
19
|
@question_references = []
|
@@ -99,4 +104,4 @@ module CanvasCc::CanvasCC::Models
|
|
99
104
|
end
|
100
105
|
end
|
101
106
|
end
|
102
|
-
end
|
107
|
+
end
|
data/lib/canvas_cc/version.rb
CHANGED
@@ -5,6 +5,7 @@ module CanvasCc::CanvasCC
|
|
5
5
|
subject { CanvasCc::CanvasCC::AssessmentWriter.new(work_dir, assessment) }
|
6
6
|
let(:work_dir) { Dir.mktmpdir }
|
7
7
|
let(:assessment) { CanvasCc::CanvasCC::Models::Assessment.new }
|
8
|
+
let(:assignment) {CanvasCc::CanvasCC::Models::Assignment.new}
|
8
9
|
|
9
10
|
after(:each) do
|
10
11
|
FileUtils.rm_r work_dir
|
@@ -21,6 +22,7 @@ module CanvasCc::CanvasCC
|
|
21
22
|
assessment.description = 'this is a bunch of description'
|
22
23
|
assessment.lock_at = Time.parse('Sat, 08 Feb 2014 17:00:00 GMT')
|
23
24
|
assessment.unlock_at = Time.parse('Sat, 08 Feb 2014 18:00:00 GMT')
|
25
|
+
assessment.show_correct_answers_at = Time.parse('Sat, 08 Feb 2014 18:00:00 GMT')
|
24
26
|
assessment.time_limit = '12'
|
25
27
|
assessment.allowed_attempts = '13'
|
26
28
|
assessment.scoring_policy = '14'
|
@@ -44,6 +46,7 @@ module CanvasCc::CanvasCC
|
|
44
46
|
expect(root.%('description').text).to eq assessment.description
|
45
47
|
expect(root.%('lock_at').text).to eq '2014-02-08T17:00:00'
|
46
48
|
expect(root.%('unlock_at').text).to eq '2014-02-08T18:00:00'
|
49
|
+
expect(root.%('show_correct_answers_at').text).to eq '2014-02-08T18:00:00'
|
47
50
|
expect(root.%('time_limit').text).to eq assessment.time_limit
|
48
51
|
expect(root.%('allowed_attempts').text).to eq assessment.allowed_attempts
|
49
52
|
expect(root.%('scoring_policy').text).to eq assessment.scoring_policy
|
@@ -53,6 +56,27 @@ module CanvasCc::CanvasCC
|
|
53
56
|
expect(root.%('quiz_type').text).to eq assessment.quiz_type
|
54
57
|
end
|
55
58
|
|
59
|
+
it 'creates assignment meta' do
|
60
|
+
assessment.identifier = 'someidthing'
|
61
|
+
assessment.title = 'assersemurnt'
|
62
|
+
assessment.description = 'this is a bunch of description'
|
63
|
+
assessment.assignment = assignment
|
64
|
+
assignment.identifier = assessment.identifier
|
65
|
+
assignment.title = assessment.title
|
66
|
+
|
67
|
+
assessment.items = []
|
68
|
+
subject.write
|
69
|
+
|
70
|
+
xml = Nokogiri::XML(File.read(File.join(work_dir, assessment.meta_file_path)))
|
71
|
+
|
72
|
+
root = xml.at_xpath('xmlns:quiz')
|
73
|
+
expect(root.attributes['identifier'].value).to eq assessment.identifier
|
74
|
+
expect(root.%('title').text).to eq assessment.title
|
75
|
+
expect(root.%('assignment').attributes['identifier'].value).to eq(assessment.identifier)
|
76
|
+
expect(root.%('assignment title').text).to eq(assessment.title)
|
77
|
+
|
78
|
+
end
|
79
|
+
|
56
80
|
it 'creates the assessment qti file' do
|
57
81
|
assessment.identifier = 'someidthing'
|
58
82
|
assessment.title = 'assersemurnt'
|
@@ -92,4 +116,4 @@ module CanvasCc::CanvasCC
|
|
92
116
|
end
|
93
117
|
|
94
118
|
end
|
95
|
-
end
|
119
|
+
end
|
@@ -14,7 +14,20 @@ describe CanvasCc::CanvasCC::Models::Assessment do
|
|
14
14
|
it_behaves_like 'it has an attribute for', :shuffle_answers
|
15
15
|
it_behaves_like 'it has an attribute for', :time_limit
|
16
16
|
it_behaves_like 'it has an attribute for', :quiz_type
|
17
|
-
it_behaves_like 'it has an attribute for', :
|
17
|
+
it_behaves_like 'it has an attribute for', :assignment
|
18
|
+
it_behaves_like 'it has an attribute for', :hide_results
|
19
|
+
it_behaves_like 'it has an attribute for', :require_lockdown_browser
|
20
|
+
it_behaves_like 'it has an attribute for', :require_lockdown_browser_for_results
|
21
|
+
it_behaves_like 'it has an attribute for', :require_lockdown_browser_monitor
|
22
|
+
it_behaves_like 'it has an attribute for', :lockdown_browser_monitor_data
|
23
|
+
it_behaves_like 'it has an attribute for', :show_correct_answers
|
24
|
+
it_behaves_like 'it has an attribute for', :anonymous_submissions
|
25
|
+
it_behaves_like 'it has an attribute for', :could_be_locked
|
26
|
+
it_behaves_like 'it has an attribute for', :available
|
27
|
+
it_behaves_like 'it has an attribute for', :allowed_attempts
|
28
|
+
it_behaves_like 'it has an attribute for', :one_question_at_a_time
|
29
|
+
it_behaves_like 'it has an attribute for', :cant_go_back
|
30
|
+
it_behaves_like 'it has an attribute for', :assignment_group_identifierref
|
18
31
|
|
19
32
|
it_behaves_like 'it has an attribute for', :question_references, []
|
20
33
|
it_behaves_like 'it has an attribute for', :items
|
@@ -128,4 +141,4 @@ describe CanvasCc::CanvasCC::Models::Assessment do
|
|
128
141
|
expect(group2.questions.map(&:identifier)).to eq qb3.questions.map(&:identifier)
|
129
142
|
end
|
130
143
|
|
131
|
-
end
|
144
|
+
end
|
data/test/tmp/.gitkeep
ADDED
File without changes
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Instructure
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -227,8 +227,8 @@ executables: []
|
|
227
227
|
extensions: []
|
228
228
|
extra_rdoc_files: []
|
229
229
|
files:
|
230
|
-
- ".gitignore"
|
231
230
|
- Gemfile
|
231
|
+
- Gemfile.lock
|
232
232
|
- LICENSE.txt
|
233
233
|
- README.md
|
234
234
|
- Rakefile
|
@@ -368,6 +368,7 @@ files:
|
|
368
368
|
- test/test_helper.rb
|
369
369
|
- test/test_question_helper.rb
|
370
370
|
- test/test_wiki_helper.rb
|
371
|
+
- test/tmp/.gitkeep
|
371
372
|
- test/unit/canvas/assessment_test.rb
|
372
373
|
- test/unit/canvas/assignment_test.rb
|
373
374
|
- test/unit/canvas/converter_test.rb
|
@@ -472,6 +473,7 @@ test_files:
|
|
472
473
|
- test/test_helper.rb
|
473
474
|
- test/test_question_helper.rb
|
474
475
|
- test/test_wiki_helper.rb
|
476
|
+
- test/tmp/.gitkeep
|
475
477
|
- test/unit/canvas/assessment_test.rb
|
476
478
|
- test/unit/canvas/assignment_test.rb
|
477
479
|
- test/unit/canvas/converter_test.rb
|