moodle2cc 0.2.16 → 0.2.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2MyZjI2MDhmODI3YmRkZTg5NWQ4YjgzZjRhZWU0NDUzYTViYWExNg==
4
+ MmUyNmJjNWUxYzEwOGRiYTBlNDljMTc3ZjNlMWQyY2Y0ZjA1MTAxNQ==
5
5
  data.tar.gz: !binary |-
6
- MTA3YWYwMjI1YjEwODZmZWU4NzI4NmEwZTZlMjhkODUwZjI4MjYxZA==
6
+ NjE0OWI3Y2JlNGI3ZjJhNmJlOThkOGU0YWJlNTI5NzZjMzE2MGUwYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NGE2YmFhZjJkNDUyMzNhZGI2OWE5MjYwMDRhZmU5ZDIxNTJhZjBlNzAwMmI4
10
- MmUyYTIyYWRiNjAxOTFlN2IwNjNmMTU5Yzc3ZTlmZGRkMzNjNTAxMGZjZDNl
11
- OTRkN2VlZjhkOTE2YTI3NDU0NjFhODhiNGE1Zjk3NjM0NDA0NTQ=
9
+ NjU4NmEzZTA5ZDJlNzRiOTJmZjlkMzVkMThiNmViNTVhNzZlNzcwNzhmNDhm
10
+ OWFjOTRlNjI4Y2I0N2UwYzViMWJkZmJlNWI2YzJmOGViNTFhOTVjMjk0Y2Ni
11
+ OTkwMWZiOTNjMTcwNzZjOTczMTdjM2M0NDAxZDM5Y2ZlYjMxZmI=
12
12
  data.tar.gz: !binary |-
13
- OGYyMmYyZGFmOTQ0NTY3ODk4Mzk5NjAxN2Y3MDZmZTZmNWRjNmY0ZjBjY2Rl
14
- ODhiNDJiYzE2ZmRhYTIzY2Y4MDgwMjgwMTAxODU3NTBmNmIxYzMwYzRkNjc3
15
- MDZhMGQ0OGUzNGQ1NGIxNTlmYjg2OWNlMzI3ZTRmYzA1NWM0ZTk=
13
+ NzBiNTk5OWMxYmExYmM2NTdmNGQwOGUwZWUxNGE5YzI2YzFkZDA3OWQxZDA2
14
+ NTdiZDFlMTkxMmZkNjRiZWM1MjFiMmEzNzA5OTE4N2QwMDE0NzZkYjY2ZmFl
15
+ MGI0NWNjYzRjZDhhYjcxOWFiZTRjYjFlOWFhNTNhZjZhZGE3NWE=
data/Changelog CHANGED
@@ -1,3 +1,6 @@
1
+ 2015-03-04 Version 0.2.17
2
+ * Add grading information to discussion topics
3
+
1
4
  2014-09-17 Version 0.2.16
2
5
  * Add choices to yes/no questionnaire questions
3
6
 
@@ -44,6 +44,14 @@ module Moodle2CC::CanvasCC
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
47
+ if discussion.points_possible
48
+ xml.assignment('identifier' => "#{meta_resource.identifier}_assignment" ) do |a|
49
+ a.title discussion.title
50
+ a.submission_types 'discussion_topic'
51
+ a.grading_type 'points'
52
+ a.points_possible discussion.points_possible
53
+ end
54
+ end
47
55
  }
48
56
  end.to_xml
49
57
  File.open(File.join(@work_dir, meta_resource.href), 'w') { |f| f.write(xml) }
@@ -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
3
+ attr_accessor :identifier, :title, :text, :discussion_type, :workflow_state, :require_initial_post, :points_possible
4
4
  DISCUSSION_ID_POSTFIX = '_DISCUSSION'
5
5
  DISCUSSION_META_POSTFIX = '_meta'
6
6
  IMSDT_TYPE = 'imsdt_xmlv1p1'
@@ -4,7 +4,7 @@ module Moodle2CC::Moodle2::Models
4
4
  attr_accessor :id, :module_id, :type, :name, :intro, :intro_format, :assessed, :assess_time_start, :assess_time_finish, :scale,
5
5
  :max_bytes, :max_attachments, :force_subsscribe, :tracking_type, :rss_type, :rss_articles,
6
6
  :time_modified, :warn_after, :block_after, :block_period, :completion_discussions, :completion_replies,
7
- :completion_posts, :visible
7
+ :completion_posts, :visible, :points_possible
8
8
 
9
9
  end
10
10
  end
@@ -46,6 +46,15 @@ module Moodle2CC::Moodle2::Parsers
46
46
  forum.completion_replies = parse_text(forum_xml, "/activity/#{module_name}/completionreplies")
47
47
  forum.completion_posts = parse_text(forum_xml, "/activity/#{module_name}/completionposts")
48
48
  end
49
+ grade_file = File.join(activity_dir, "grades.xml")
50
+ if File.exists?(grade_file)
51
+ File.open(grade_file) do |f|
52
+ grade_xml = Nokogiri::XML(f)
53
+ if node = grade_xml.at_xpath("activity_gradebook/grade_items/grade_item/grademax")
54
+ forum.points_possible = node.text
55
+ end
56
+ end
57
+ end
49
58
  parse_module(activity_dir, forum)
50
59
  forum
51
60
  end
@@ -11,6 +11,10 @@ module Moodle2CC::Moodle2Converter
11
11
  discussion.discussion_type = 'threaded'
12
12
  discussion.workflow_state = workflow_state(forum.visible)
13
13
  discussion.require_initial_post = (forum.type == 'qanda')
14
+
15
+ points = forum.points_possible.to_i
16
+ discussion.points_possible = points if points > 0
17
+
14
18
  discussion
15
19
  end
16
20
 
@@ -1,3 +1,3 @@
1
1
  module Moodle2CC
2
- VERSION = "0.2.16"
2
+ VERSION = "0.2.17"
3
3
  end
@@ -25,6 +25,7 @@ describe Moodle2CC::CanvasCC::DiscussionWriter do
25
25
  discussion.title = 'Discussion Title'
26
26
  discussion.text = '<p>discussion_text</p>'
27
27
  discussion.discussion_type = 'threaded'
28
+ discussion.points_possible = 99
28
29
  writer.write
29
30
  xml = Nokogiri::XML(File.read(File.join(work_dir, discussion.meta_resource.href)))
30
31
  expect(xml.at_xpath('xmlns:topicMeta/@identifier').value).to eq('discussion_id_meta')
@@ -33,6 +34,7 @@ describe Moodle2CC::CanvasCC::DiscussionWriter do
33
34
  expect(xml.%('topicMeta/type').text).to eq 'topic'
34
35
  expect(xml.%('topicMeta/position').text).to eq ''
35
36
  expect(xml.%('topicMeta/discussion_type').text).to eq 'threaded'
37
+ expect(xml.%('topicMeta/assignment/points_possible').text).to eq '99'
36
38
  end
37
39
 
38
40
  end
@@ -3,7 +3,6 @@ require 'spec_helper'
3
3
  describe Moodle2CC::Moodle2::Parsers::ForumParser do
4
4
  subject(:parser) { Moodle2CC::Moodle2::Parsers::ForumParser.new(fixture_path(File.join('moodle2', 'backup')))}
5
5
 
6
-
7
6
  it 'parses a moodle forum' do
8
7
  forums = parser.parse
9
8
  expect(forums.count).to eq 2
@@ -32,6 +31,7 @@ describe Moodle2CC::Moodle2::Parsers::ForumParser do
32
31
  expect(forum.completion_replies).to eq '0'
33
32
  expect(forum.completion_posts).to eq '0'
34
33
  expect(forum.visible).to eq true
34
+ expect(forum.points_possible).to eq "42"
35
35
  end
36
36
 
37
37
 
@@ -1,6 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <activity_gradebook>
3
3
  <grade_items>
4
+ <grade_item>
5
+ <grademax>42</grademax>
6
+ </grade_item>
4
7
  </grade_items>
5
8
  <grade_letters>
6
9
  </grade_letters>
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.16
4
+ version: 0.2.17
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: 2014-09-17 00:00:00.000000000 Z
13
+ date: 2015-03-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubyzip
@@ -822,7 +822,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
822
822
  version: '0'
823
823
  requirements: []
824
824
  rubyforge_project:
825
- rubygems_version: 2.4.1
825
+ rubygems_version: 2.4.5
826
826
  signing_key:
827
827
  specification_version: 4
828
828
  summary: Migrates Moodle backup ZIP to IMS Common Cartridge package