moodle2cc 0.2.43 → 0.2.45
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/moodle2cc/canvas/question.rb +3 -3
- data/lib/moodle2cc/canvas_cc/assessment_writer.rb +3 -3
- data/lib/moodle2cc/canvas_cc/models/assessment.rb +2 -3
- data/lib/moodle2cc/canvas_cc/question_bank_writer.rb +2 -2
- data/lib/moodle2cc/migrator.rb +4 -4
- data/lib/moodle2cc/moodle2/parsers/file_parser.rb +2 -2
- data/lib/moodle2cc/moodle2/parsers/forum_parser.rb +2 -2
- data/lib/moodle2cc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98689e50dc5e33cde859b130da10873353ecd86ef81e4aa765beb9dd969f87d3
|
4
|
+
data.tar.gz: 8d58e5bcc83ef54b9387913f5594693e39b74f9a67c5546f8a42e3795ad2bec8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4854cb70b2fb66f4bd26c8bf5ee6d6464131bd32b6101a4e2abd28100ae9ec80a86eb4f350c412847aca612df38199ebf71573daa7ef5ffe5c54a656e699e0db
|
7
|
+
data.tar.gz: b08f962f311ee2cf4806af2a85a6abd4df96549abfa796807f10ce521d4d7abe531f6c8146be75aa3242fbfe944fce0da58a5613f3537a541c64a533290cf911
|
@@ -148,9 +148,9 @@ module Moodle2CC::Canvas
|
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
-
|
152
|
-
|
153
|
-
|
151
|
+
if question.instance_id
|
152
|
+
@assessment_question_identifierref = create_key(question.id, "#{@identifier_prefix}question_")
|
153
|
+
end
|
154
154
|
end
|
155
155
|
|
156
156
|
def create_item_xml(section_node)
|
@@ -37,7 +37,7 @@ module Moodle2CC::CanvasCC
|
|
37
37
|
end.to_xml
|
38
38
|
|
39
39
|
file_path = File.join(@work_dir, assessment.meta_file_path)
|
40
|
-
FileUtils.mkdir_p(File.dirname(file_path)) unless File.
|
40
|
+
FileUtils.mkdir_p(File.dirname(file_path)) unless File.exist?(File.dirname(file_path))
|
41
41
|
File.open(file_path, 'w') { |f| f.write(xml) }
|
42
42
|
end
|
43
43
|
|
@@ -75,8 +75,8 @@ module Moodle2CC::CanvasCC
|
|
75
75
|
end.to_xml
|
76
76
|
|
77
77
|
file_path = File.join(@work_dir, assessment.qti_file_path)
|
78
|
-
FileUtils.mkdir_p(File.dirname(file_path)) unless File.
|
78
|
+
FileUtils.mkdir_p(File.dirname(file_path)) unless File.exist?(File.dirname(file_path))
|
79
79
|
File.open(file_path, 'w') { |f| f.write(xml) }
|
80
80
|
end
|
81
81
|
end
|
82
|
-
end
|
82
|
+
end
|
@@ -93,11 +93,10 @@ module Moodle2CC::CanvasCC::Models
|
|
93
93
|
new_group = Moodle2CC::CanvasCC::Models::QuestionGroup.new
|
94
94
|
new_group.identifier = "#{@identifier}#{bank.identifier}_random_group"
|
95
95
|
new_group.selection_number = count
|
96
|
-
|
97
|
-
new_group.questions = bank.questions.map(&:dup)
|
96
|
+
new_group.questions = bank.questions.map(&:dup).map{|q| (q.identifier = "random_#{q.identifier}") && q }
|
98
97
|
child_banks = bank.find_children_banks(question_banks)
|
99
98
|
child_banks.each do |child|
|
100
|
-
new_group.questions += child.questions.map(&:dup)
|
99
|
+
new_group.questions += child.questions.map(&:dup).map{|q| (q.identifier = "random_#{q.identifier}") && q }
|
101
100
|
end
|
102
101
|
|
103
102
|
@items << new_group
|
@@ -37,8 +37,8 @@ module Moodle2CC::CanvasCC
|
|
37
37
|
end.to_xml
|
38
38
|
|
39
39
|
file_path = File.join(@work_dir, bank_resource.href)
|
40
|
-
FileUtils.mkdir_p(File.dirname(file_path)) unless File.
|
40
|
+
FileUtils.mkdir_p(File.dirname(file_path)) unless File.exist?(File.dirname(file_path))
|
41
41
|
File.open(file_path, 'w') { |f| f.write(xml) }
|
42
42
|
end
|
43
43
|
end
|
44
|
-
end
|
44
|
+
end
|
data/lib/moodle2cc/migrator.rb
CHANGED
@@ -13,7 +13,7 @@ module Moodle2CC
|
|
13
13
|
@destination = destination
|
14
14
|
@format = options['format'] || 'cc'
|
15
15
|
Moodle2CC::Logger.logger = options['logger'] || ::Logger.new(STDOUT)
|
16
|
-
raise(Moodle2CC::Error, "'#{@source}' does not exist") unless File.
|
16
|
+
raise(Moodle2CC::Error, "'#{@source}' does not exist") unless File.exist?(@source)
|
17
17
|
raise(Moodle2CC::Error, "'#{@destination}' is not a directory") unless File.directory?(@destination)
|
18
18
|
raise(Moodle2CC::Error, "'#{@format}' is not a valid format. Please use 'cc' or 'canvas'.") unless ['cc', 'canvas'].include?(@format)
|
19
19
|
@converter_class = @format == 'cc' ? Moodle2CC::CC::Converter : Moodle2CC::Canvas::Converter
|
@@ -51,9 +51,9 @@ module Moodle2CC
|
|
51
51
|
|
52
52
|
def moodle_version
|
53
53
|
if File.directory?(@source)
|
54
|
-
if File.
|
54
|
+
if File.exist?(File.join(@source, 'moodle_backup.xml'))
|
55
55
|
MOODLE_2
|
56
|
-
elsif File.
|
56
|
+
elsif File.exist?(File.join(@source, 'moodle.xml'))
|
57
57
|
MOODLE_1_9
|
58
58
|
end
|
59
59
|
else
|
@@ -68,4 +68,4 @@ module Moodle2CC
|
|
68
68
|
end
|
69
69
|
|
70
70
|
end
|
71
|
-
end
|
71
|
+
end
|
@@ -39,7 +39,7 @@ module Moodle2CC::Moodle2::Parsers
|
|
39
39
|
file.repository_id = parse_text(node, 'repositoryid')
|
40
40
|
file.reference = parse_text(node, 'reference')
|
41
41
|
file.file_location = File.join(@work_dir, FILES_DIR, file.content_hash[0..1], file.content_hash)
|
42
|
-
if file.file_size > 0 && File.
|
42
|
+
if file.file_size > 0 && File.exist?(file.file_location)
|
43
43
|
files << file
|
44
44
|
else
|
45
45
|
missing_files << file
|
@@ -49,4 +49,4 @@ module Moodle2CC::Moodle2::Parsers
|
|
49
49
|
end
|
50
50
|
|
51
51
|
end
|
52
|
-
end
|
52
|
+
end
|
@@ -47,7 +47,7 @@ module Moodle2CC::Moodle2::Parsers
|
|
47
47
|
forum.completion_posts = parse_text(forum_xml, "/activity/#{module_name}/completionposts")
|
48
48
|
end
|
49
49
|
grade_file = File.join(activity_dir, "grades.xml")
|
50
|
-
if File.
|
50
|
+
if File.exist?(grade_file)
|
51
51
|
File.open(grade_file) do |f|
|
52
52
|
grade_xml = Nokogiri::XML(f)
|
53
53
|
if node = grade_xml.at_xpath("activity_gradebook/grade_items/grade_item/grademax")
|
@@ -60,4 +60,4 @@ module Moodle2CC::Moodle2::Parsers
|
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
63
|
-
end
|
63
|
+
end
|
data/lib/moodle2cc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moodle2cc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.45
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Durtschi
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-03-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubyzip
|