moodle2cc 0.2.27 → 0.2.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Changelog +4 -0
- data/lib/moodle2cc/canvas_cc/discussion_writer.rb +1 -1
- data/lib/moodle2cc/canvas_cc/models/discussion.rb +1 -1
- data/lib/moodle2cc/moodle2/models/forum.rb +1 -1
- data/lib/moodle2cc/moodle2/parsers/forum_parser.rb +1 -1
- data/lib/moodle2cc/moodle2converter/assessment_converter.rb +2 -2
- data/lib/moodle2cc/moodle2converter/assignment_converter.rb +1 -1
- data/lib/moodle2cc/moodle2converter/converter_helper.rb +13 -1
- data/lib/moodle2cc/moodle2converter/discussion_converter.rb +2 -1
- data/lib/moodle2cc/moodle2converter/feedback_converter.rb +1 -1
- data/lib/moodle2cc/moodle2converter/folder_converter.rb +1 -1
- data/lib/moodle2cc/moodle2converter/glossary_converter.rb +1 -1
- data/lib/moodle2cc/moodle2converter/html_converter.rb +2 -2
- data/lib/moodle2cc/moodle2converter/label_converter.rb +1 -1
- data/lib/moodle2cc/moodle2converter/migrator.rb +5 -0
- data/lib/moodle2cc/moodle2converter/page_converter.rb +1 -1
- data/lib/moodle2cc/moodle2converter/questionnaire_converter.rb +1 -1
- data/lib/moodle2cc/moodle2converter/section_converter.rb +1 -1
- data/lib/moodle2cc/moodle2converter/wiki_converter.rb +2 -2
- data/lib/moodle2cc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDgzMGY2MjI2OGU3YmM4NDI5Mzg5MTRkNGYwMzM5OGU4YWU5MzBiNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzVhYjExMjAwODM0OTVkMjg0MTdmYTY1Njc0ZTI0ZWE0ZTFlZmYxMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTQ1MjhmYzI5NWE3NGFjYWVlZWY5NWI1NmEwZGYyNzJmMjQwOTNlYzUxZWFj
|
10
|
+
NzJjOTI2MjM2ZjE2MTNlOWE1N2UxMmQxNTRiM2QwODU2MzlhYTc3MzBiZjlh
|
11
|
+
N2U2MTQ5ZTFhYTBhMGU3YWMwMzVkMDE2MjI5MmFjNzU1YWIwNzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjgyZDZlM2M4NGM1YWE5YmVjMjg5MDQ5Nzg5NDE1N2M4ZmYzNjMzZDlhY2Iy
|
14
|
+
ZmUyZDQwMTc5YzFhZTQyNWMxMWZiOTU0Njg1MDY3ZGNhMzYzZTM2MzNjYjA4
|
15
|
+
NzQzY2M4ZjJmZWZmMDRlMWJiNDc1NmViNzNmNjk3ZWFhZGE3YTg=
|
data/Changelog
CHANGED
@@ -40,7 +40,7 @@ module Moodle2CC::CanvasCC
|
|
40
40
|
xml.topic_id discussion_resource.identifier
|
41
41
|
xml.title discussion.title
|
42
42
|
xml.position
|
43
|
-
xml.type 'topic'
|
43
|
+
xml.type (discussion.is_announcement ? 'announcement' : 'topic')
|
44
44
|
xml.discussion_type discussion.discussion_type
|
45
45
|
xml.require_initial_post discussion.require_initial_post
|
46
46
|
xml.workflow_state discussion.workflow_state
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Moodle2CC::CanvasCC::Models
|
2
2
|
class Discussion
|
3
|
-
attr_accessor :identifier, :title, :text, :discussion_type, :workflow_state, :require_initial_post, :points_possible
|
3
|
+
attr_accessor :identifier, :title, :text, :discussion_type, :workflow_state, :require_initial_post, :points_possible, :is_announcement
|
4
4
|
DISCUSSION_ID_POSTFIX = '_DISCUSSION'
|
5
5
|
DISCUSSION_META_POSTFIX = '_meta'
|
6
6
|
IMSDT_TYPE = 'imsdt_xmlv1p1'
|
@@ -2,7 +2,7 @@ module Moodle2CC::Moodle2::Models
|
|
2
2
|
class Forum
|
3
3
|
|
4
4
|
attr_accessor :id, :module_id, :type, :name, :intro, :intro_format, :assessed, :assess_time_start, :assess_time_finish, :scale,
|
5
|
-
:max_bytes, :max_attachments, :
|
5
|
+
:max_bytes, :max_attachments, :force_subscribe, :tracking_type, :rss_type, :rss_articles,
|
6
6
|
:time_modified, :warn_after, :block_after, :block_period, :completion_discussions, :completion_replies,
|
7
7
|
:completion_posts, :visible, :points_possible
|
8
8
|
|
@@ -34,7 +34,7 @@ module Moodle2CC::Moodle2::Parsers
|
|
34
34
|
forum.scale = parse_text(forum_xml, "/activity/#{module_name}/scale")
|
35
35
|
forum.max_bytes = parse_text(forum_xml, "/activity/#{module_name}/maxbytes")
|
36
36
|
forum.max_attachments = parse_text(forum_xml, "/activity/#{module_name}/maxattachments")
|
37
|
-
forum.
|
37
|
+
forum.force_subscribe = parse_boolean(forum_xml, "/activity/#{module_name}/forcesubscribe")
|
38
38
|
forum.tracking_type = parse_text(forum_xml, "/activity/#{module_name}/trackingtype")
|
39
39
|
forum.rss_type = parse_text(forum_xml, "/activity/#{module_name}/rsstype")
|
40
40
|
forum.rss_articles = parse_text(forum_xml, "/activity/#{module_name}/rssarticles")
|
@@ -10,7 +10,7 @@ module Moodle2CC::Moodle2Converter
|
|
10
10
|
|
11
11
|
def convert_quiz(moodle_quiz)
|
12
12
|
canvas_assessment = Moodle2CC::CanvasCC::Models::Assessment.new
|
13
|
-
canvas_assessment.identifier =
|
13
|
+
canvas_assessment.identifier = generate_unique_identifier_for_activity(moodle_quiz)
|
14
14
|
canvas_assessment.title = truncate_text(moodle_quiz.name)
|
15
15
|
canvas_assessment.description = moodle_quiz.intro
|
16
16
|
canvas_assessment.workflow_state = workflow_state(moodle_quiz.visible)
|
@@ -37,7 +37,7 @@ module Moodle2CC::Moodle2Converter
|
|
37
37
|
|
38
38
|
def convert_choice(moodle_choice)
|
39
39
|
canvas_assessment = Moodle2CC::CanvasCC::Models::Assessment.new
|
40
|
-
canvas_assessment.identifier =
|
40
|
+
canvas_assessment.identifier = generate_unique_identifier_for_activity(moodle_choice)
|
41
41
|
canvas_assessment.title = truncate_text(moodle_choice.name)
|
42
42
|
canvas_assessment.description = ''
|
43
43
|
canvas_assessment.workflow_state = workflow_state(moodle_choice.visible)
|
@@ -5,7 +5,7 @@ module Moodle2CC::Moodle2Converter
|
|
5
5
|
def convert(moodle_assignment, moodle_grading_scales)
|
6
6
|
|
7
7
|
canvas_assignment = Moodle2CC::CanvasCC::Models::Assignment.new
|
8
|
-
canvas_assignment.identifier =
|
8
|
+
canvas_assignment.identifier = generate_unique_identifier_for_activity(moodle_assignment)
|
9
9
|
canvas_assignment.title = truncate_text(moodle_assignment.name)
|
10
10
|
canvas_assignment.body = moodle_assignment.intro
|
11
11
|
canvas_assignment.due_at = Time.at(Integer(moodle_assignment.due_date)) if moodle_assignment.due_date
|
@@ -48,9 +48,21 @@ module Moodle2CC
|
|
48
48
|
"m2#{SecureRandom.uuid.gsub('-', '')}"
|
49
49
|
end
|
50
50
|
|
51
|
+
def get_unique_identifier_for_activity(activity)
|
52
|
+
# use when we want to retrieve an existing id, not generate a new one
|
53
|
+
id = Moodle2Converter::Migrator.activity_id_map[activity.hash]
|
54
|
+
unless id
|
55
|
+
puts "could not find matching id for #{activity.inspect}"
|
56
|
+
id = generate_unique_identifier_for_activity(activity)
|
57
|
+
end
|
58
|
+
id
|
59
|
+
end
|
60
|
+
|
51
61
|
def generate_unique_identifier_for_activity(activity)
|
52
62
|
if lookup = ACTIVITY_LOOKUP[activity.class]
|
53
|
-
generate_unique_identifier_for(activity.id, lookup[:suffix])
|
63
|
+
unique_id = generate_unique_identifier_for(activity.id, lookup[:suffix])
|
64
|
+
Moodle2Converter::Migrator.activity_id_map[activity.hash] = unique_id
|
65
|
+
unique_id
|
54
66
|
else
|
55
67
|
raise "Unknown activity type: #{activity.class}"
|
56
68
|
end
|
@@ -5,9 +5,10 @@ module Moodle2CC::Moodle2Converter
|
|
5
5
|
|
6
6
|
def convert(forum)
|
7
7
|
discussion = Moodle2CC::CanvasCC::Models::Discussion.new
|
8
|
-
discussion.identifier =
|
8
|
+
discussion.identifier = generate_unique_identifier_for_activity(forum)
|
9
9
|
discussion.title = truncate_text(forum.name)
|
10
10
|
discussion.text = forum.intro
|
11
|
+
discussion.is_announcement = forum.force_subscribe
|
11
12
|
discussion.discussion_type = 'threaded'
|
12
13
|
discussion.workflow_state = workflow_state(forum.visible)
|
13
14
|
discussion.require_initial_post = (forum.type == 'qanda')
|
@@ -4,7 +4,7 @@ module Moodle2CC::Moodle2Converter
|
|
4
4
|
|
5
5
|
def convert_feedback(moodle_feedback)
|
6
6
|
canvas_assessment = Moodle2CC::CanvasCC::Models::Assessment.new
|
7
|
-
canvas_assessment.identifier =
|
7
|
+
canvas_assessment.identifier = generate_unique_identifier_for_activity(moodle_feedback)
|
8
8
|
canvas_assessment.title = truncate_text(moodle_feedback.name)
|
9
9
|
canvas_assessment.description = moodle_feedback.intro
|
10
10
|
canvas_assessment.workflow_state = workflow_state(moodle_feedback.visible)
|
@@ -8,7 +8,7 @@ module Moodle2CC::Moodle2Converter
|
|
8
8
|
|
9
9
|
def convert(moodle_folder)
|
10
10
|
canvas_page = Moodle2CC::CanvasCC::Models::Page.new
|
11
|
-
canvas_page.identifier =
|
11
|
+
canvas_page.identifier = generate_unique_identifier_for_activity(moodle_folder)
|
12
12
|
canvas_page.page_name = moodle_folder.name
|
13
13
|
canvas_page.workflow_state = workflow_state(moodle_folder.visible)
|
14
14
|
canvas_page.editing_roles = 'teachers'
|
@@ -8,7 +8,7 @@ module Moodle2CC::Moodle2Converter
|
|
8
8
|
|
9
9
|
def convert(moodle_glossary)
|
10
10
|
canvas_page = Moodle2CC::CanvasCC::Models::Page.new
|
11
|
-
canvas_page.identifier =
|
11
|
+
canvas_page.identifier = generate_unique_identifier_for_activity(moodle_glossary)
|
12
12
|
canvas_page.page_name = moodle_glossary.name
|
13
13
|
canvas_page.workflow_state = 'active'
|
14
14
|
canvas_page.editing_roles = 'teachers,students'
|
@@ -84,7 +84,7 @@ module Moodle2CC::Moodle2Converter
|
|
84
84
|
case activity
|
85
85
|
when 'assignment'
|
86
86
|
if assignment = @moodle_course.assignments.find { |assignment| assignment.id == id }
|
87
|
-
"#{OBJECT_TOKEN}/assignments/#{
|
87
|
+
"#{OBJECT_TOKEN}/assignments/#{get_unique_identifier_for_activity(assignment)}#{anchor}"
|
88
88
|
end
|
89
89
|
when 'page'
|
90
90
|
if page = @moodle_course.pages.find { |page| page.id == id }
|
@@ -92,7 +92,7 @@ module Moodle2CC::Moodle2Converter
|
|
92
92
|
end
|
93
93
|
when 'forum'
|
94
94
|
if forum = @moodle_course.forums.find { |forum| forum.id == id }
|
95
|
-
"#{OBJECT_TOKEN}/discussion_topics/#{
|
95
|
+
"#{OBJECT_TOKEN}/discussion_topics/#{get_unique_identifier_for_activity(forum)}#{anchor}"
|
96
96
|
end
|
97
97
|
else
|
98
98
|
puts "unknown activity to replace link for. activity:#{activity} id:#{id}"
|
@@ -11,7 +11,7 @@ module Moodle2CC
|
|
11
11
|
module_item.indent = '0'
|
12
12
|
|
13
13
|
if moodle_label.convert_to_page?
|
14
|
-
module_item.identifierref =
|
14
|
+
module_item.identifierref = get_unique_identifier_for_activity(moodle_label)
|
15
15
|
module_item.content_type = CanvasCC::Models::ModuleItem::CONTENT_TYPE_WIKI_PAGE
|
16
16
|
elsif moodle_label.convert_to_header?
|
17
17
|
module_item.content_type = CanvasCC::Models::ModuleItem::CONTENT_TYPE_CONTEXT_MODULE_SUB_HEADER
|
@@ -197,10 +197,15 @@ module Moodle2CC::Moodle2Converter
|
|
197
197
|
|
198
198
|
def self.clear_unique_id_set!
|
199
199
|
@unique_id_set = Set.new
|
200
|
+
@activity_id_map = {}
|
200
201
|
end
|
201
202
|
|
202
203
|
def self.unique_id_set
|
203
204
|
@unique_id_set ||= Set.new
|
204
205
|
end
|
206
|
+
|
207
|
+
def self.activity_id_map
|
208
|
+
@activity_id_map ||= {}
|
209
|
+
end
|
205
210
|
end
|
206
211
|
end
|
@@ -4,7 +4,7 @@ module Moodle2CC::Moodle2Converter
|
|
4
4
|
|
5
5
|
def convert(moodle_page)
|
6
6
|
canvas_page = Moodle2CC::CanvasCC::Models::Page.new
|
7
|
-
canvas_page.identifier =
|
7
|
+
canvas_page.identifier = generate_unique_identifier_for_activity(moodle_page)
|
8
8
|
canvas_page.page_name = moodle_page.name
|
9
9
|
canvas_page.workflow_state = workflow_state(moodle_page.visible)
|
10
10
|
canvas_page.editing_roles = 'teachers'
|
@@ -4,7 +4,7 @@ module Moodle2CC::Moodle2Converter
|
|
4
4
|
|
5
5
|
def convert_questionnaire(moodle_questionnaire)
|
6
6
|
canvas_assessment = Moodle2CC::CanvasCC::Models::Assessment.new
|
7
|
-
canvas_assessment.identifier =
|
7
|
+
canvas_assessment.identifier = generate_unique_identifier_for_activity(moodle_questionnaire)
|
8
8
|
canvas_assessment.title = truncate_text(moodle_questionnaire.name)
|
9
9
|
canvas_assessment.description = moodle_questionnaire.intro
|
10
10
|
canvas_assessment.workflow_state = workflow_state(moodle_questionnaire.visible)
|
@@ -54,7 +54,7 @@ module Moodle2CC
|
|
54
54
|
elsif moodle_activity.is_a? Moodle2::Models::Resource
|
55
55
|
module_item.identifierref = moodle_activity.file.content_hash if moodle_activity.file
|
56
56
|
else
|
57
|
-
module_item.identifierref =
|
57
|
+
module_item.identifierref = get_unique_identifier_for_activity(moodle_activity)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
module_item.content_type = activity_content_type(moodle_activity)
|
@@ -17,12 +17,12 @@ module Moodle2CC::Moodle2Converter
|
|
17
17
|
|
18
18
|
if moodle_wiki.first_page_title.to_s.strip.length > 0 &&
|
19
19
|
(first_page = canvas_pages.detect{|page| page.title.to_s.strip == moodle_wiki.first_page_title.to_s.strip})
|
20
|
-
first_page.identifier =
|
20
|
+
first_page.identifier = generate_unique_identifier_for_activity(moodle_wiki)
|
21
21
|
first_page.body = moodle_wiki.intro.to_s + first_page.body.to_s
|
22
22
|
first_page.page_name = moodle_wiki.name
|
23
23
|
else
|
24
24
|
first_page = Moodle2CC::CanvasCC::Models::Page.new
|
25
|
-
first_page.identifier =
|
25
|
+
first_page.identifier = generate_unique_identifier_for_activity(moodle_wiki)
|
26
26
|
first_page.body = moodle_wiki.intro
|
27
27
|
first_page.workflow_state = workflow_state(moodle_wiki.visible)
|
28
28
|
first_page.editing_roles = 'teachers'
|
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.28
|
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: 2015-
|
13
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubyzip
|