moodle2cc 0.2.31 → 0.2.32
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/lib/moodle2cc/canvas_cc/assignment_writer.rb +1 -0
- data/lib/moodle2cc/canvas_cc/models/assignment.rb +1 -1
- data/lib/moodle2cc/moodle2/extractor.rb +11 -2
- data/lib/moodle2cc/moodle2/models/assignment.rb +2 -1
- data/lib/moodle2cc/moodle2/parsers/lti_parser.rb +21 -7
- data/lib/moodle2cc/moodle2converter/assignment_converter.rb +2 -0
- data/lib/moodle2cc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84458c72175d199565c6a5bfc146137b3b37c13b
|
4
|
+
data.tar.gz: 35fc6d255908a4bb61e5c9b88680849604d435ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7987922081107f961e132a778d6f1027dcf6ca5d999a01e54ca4883b40cc7b4c9dc42684c5a816b127dd799c0c9caca83028686d741b52777e2901143fdb3df1
|
7
|
+
data.tar.gz: b42092f99be42df4685309c839000be17458dc30042fdf6118705deae2a19e5e0bbe958c51bee6cd4c6eeba32bbd670b5e671da99bf58acf1e58870c273b79a1
|
@@ -43,6 +43,7 @@ module Moodle2CC::CanvasCC
|
|
43
43
|
xml.automatic_peer_reviews assignment.automatic_peer_reviews unless assignment.automatic_peer_reviews.nil?
|
44
44
|
xml.grade_group_students_individually assignment.grade_group_students_individually unless assignment.grade_group_students_individually.nil?
|
45
45
|
xml.muted assignment.muted unless assignment.muted.nil?
|
46
|
+
xml.external_tool_url assignment.external_tool_url unless assignment.external_tool_url.nil?
|
46
47
|
}
|
47
48
|
end.to_xml
|
48
49
|
File.open(File.join(assignment_dir, Moodle2CC::CanvasCC::Models::Assignment::ASSIGNMENT_SETTINGS_FILE), 'w') { |f| f.write(xml) }
|
@@ -3,7 +3,7 @@ module Moodle2CC::CanvasCC::Models
|
|
3
3
|
attr_accessor :identifier, :title, :body, :due_at, :lock_at, :unlock_at, :all_day_date, :peer_reviews_due_at,
|
4
4
|
:assignment_group_identifier_ref, :workflow_state, :points_possible, :grading_type, :all_day,
|
5
5
|
:submission_types, :position, :peer_review_count, :peer_reviews_assigned, :peer_reviews,
|
6
|
-
:automatic_peer_reviews, :grade_group_students_individually, :muted
|
6
|
+
:automatic_peer_reviews, :grade_group_students_individually, :muted, :external_tool_url
|
7
7
|
|
8
8
|
LAR_TYPE = 'associatedcontent/imscc_xmlv1p1/learning-application-resource'
|
9
9
|
ASSIGNMENT_SETTINGS_FILE = 'assignment_settings.xml'
|
@@ -173,8 +173,17 @@ module Moodle2CC::Moodle2
|
|
173
173
|
end
|
174
174
|
|
175
175
|
def parse_lti_links(work_dir, course)
|
176
|
-
if
|
177
|
-
course.
|
176
|
+
if lti_items = Parsers::LtiParser.new(work_dir).parse
|
177
|
+
course.assignments ||= []
|
178
|
+
course.lti_links ||= []
|
179
|
+
lti_items.each do |item|
|
180
|
+
case item
|
181
|
+
when Models::Lti
|
182
|
+
course.lti_links << item
|
183
|
+
when Models::Assignment
|
184
|
+
course.assignments << item
|
185
|
+
end
|
186
|
+
end
|
178
187
|
end
|
179
188
|
end
|
180
189
|
|
@@ -5,6 +5,7 @@ module Moodle2CC::Moodle2::Models
|
|
5
5
|
:grade, :time_modified, :completion_submit, :require_submission_statement, :team_submission,
|
6
6
|
:require_all_team_members_submit, :team_submission_grouping_id, :blind_marking, :reveal_identities,
|
7
7
|
:online_text_submission, :file_submission, :max_file_size_submission, :max_files_submission,
|
8
|
-
:submission_comments, :feedback_comments, :feedback_files, :offline_grading_worksheet, :visible
|
8
|
+
:submission_comments, :feedback_comments, :feedback_files, :offline_grading_worksheet, :visible,
|
9
|
+
:external_tool_url
|
9
10
|
end
|
10
11
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'byebug'
|
1
2
|
module Moodle2CC::Moodle2
|
2
3
|
class Parsers::LtiParser
|
3
4
|
include Parsers::ParserHelper
|
@@ -17,17 +18,30 @@ module Moodle2CC::Moodle2
|
|
17
18
|
private
|
18
19
|
|
19
20
|
def parse_lti(dir)
|
20
|
-
|
21
|
+
model = nil
|
21
22
|
activity_dir = File.join(@backup_dir, dir)
|
22
23
|
File.open(File.join(activity_dir, LTI_XML)) do |f|
|
23
24
|
lti_xml = Nokogiri::XML(f)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
points = parse_text(lti_xml, '/activity/lti/grade')
|
26
|
+
if points && points.to_i > 0
|
27
|
+
model = Models::Assignment.new
|
28
|
+
model.id = lti_xml.at_xpath('/activity/lti/@id').value
|
29
|
+
model.module_id = lti_xml.at_xpath('/activity/@moduleid').value
|
30
|
+
model.name = parse_text(lti_xml, '/activity/lti/name')
|
31
|
+
model.intro = parse_text(lti_xml, "/activity/lti/intro")
|
32
|
+
model.intro_format = parse_text(lti_xml, "/activity/lti/introformat")
|
33
|
+
model.grade = points
|
34
|
+
model.external_tool_url = parse_text(lti_xml, '/activity/lti/toolurl')
|
35
|
+
else
|
36
|
+
model = Models::Lti.new
|
37
|
+
model.id = lti_xml.at_xpath('/activity/lti/@id').value
|
38
|
+
model.module_id = lti_xml.at_xpath('/activity/@moduleid').value
|
39
|
+
model.name = parse_text(lti_xml, '/activity/lti/name')
|
40
|
+
model.url = parse_text(lti_xml, '/activity/lti/toolurl')
|
41
|
+
end
|
28
42
|
end
|
29
|
-
parse_module(activity_dir,
|
30
|
-
|
43
|
+
parse_module(activity_dir, model)
|
44
|
+
model
|
31
45
|
end
|
32
46
|
|
33
47
|
|
@@ -12,6 +12,7 @@ module Moodle2CC::Moodle2Converter
|
|
12
12
|
canvas_assignment.lock_at = Time.at(Integer(moodle_assignment.cut_off_date)) if moodle_assignment.cut_off_date
|
13
13
|
canvas_assignment.unlock_at = Time.at(Integer(moodle_assignment.allow_submissions_from_date)) if moodle_assignment.allow_submissions_from_date
|
14
14
|
canvas_assignment.workflow_state = workflow_state(moodle_assignment.visible)
|
15
|
+
canvas_assignment.external_tool_url = moodle_assignment.external_tool_url
|
15
16
|
points = Integer(moodle_assignment.grade)
|
16
17
|
if points > 0 || scale = moodle_grading_scales[-1 * points] # moodle uses negative numbers for grading scale ids
|
17
18
|
if scale && scale.count == 2
|
@@ -23,6 +24,7 @@ module Moodle2CC::Moodle2Converter
|
|
23
24
|
end
|
24
25
|
canvas_assignment.submission_types << 'online_text_entry' if moodle_assignment.online_text_submission == '1'
|
25
26
|
canvas_assignment.submission_types << 'online_upload' if moodle_assignment.file_submission == '1'
|
27
|
+
canvas_assignment.submission_types << 'external_tool' if moodle_assignment.external_tool_url && moodle_assignment.external_tool_url.length > 0
|
26
28
|
else
|
27
29
|
canvas_assignment.grading_type = 'not_graded'
|
28
30
|
canvas_assignment.submission_types << 'not_graded'
|
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.32
|
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: 2016-
|
13
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubyzip
|