moodle2cc 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -1,3 +1,7 @@
1
+ 2013-07-02 Version 0.1.8
2
+ * Improved question image conversion by putting it in its own p tag
3
+ * Added support for hsuforum content
4
+
1
5
  2013-06-27 Version 0.1.7
2
6
  * Include question images when converting to QTI
3
7
  * Added travis setup for happiness
@@ -116,7 +116,7 @@ module Moodle2CC::Canvas
116
116
  material = question.text
117
117
  material = question.content || '' if material.nil?
118
118
  material = material.gsub(/\{(.*?)\}/, '[\1]')
119
- material = image_html(question.image) + material unless question.image.nil? || question.image.strip == ''
119
+ material = material + image_html(question.image) unless question.image.nil? || question.image.strip == ''
120
120
  material = RDiscount.new(material).to_html if question.format == 4 # markdown
121
121
  @material = material
122
122
 
@@ -471,7 +471,7 @@ module Moodle2CC::Canvas
471
471
 
472
472
  def image_html(image)
473
473
  image = image.strip
474
- %{<img src="#{WEB_CONTENT_TOKEN}/#{image}" alt="#{image}"/>}
474
+ %{<p><img src="#{WEB_CONTENT_TOKEN}/#{image}" alt="#{image}"/></p>}
475
475
  end
476
476
  end
477
477
  end
@@ -15,7 +15,7 @@ class Moodle2CC::ResourceFactory
15
15
  when 'html', 'text'
16
16
  @namespace.const_get(:WebContent).new(mod)
17
17
  end
18
- when 'forum'
18
+ when 'forum', 'hsuforum'
19
19
  @namespace.const_get(:DiscussionTopic).new(mod, position)
20
20
  when 'quiz', 'questionnaire', 'choice'
21
21
  @namespace.const_get(:Assessment).new(mod, position)
@@ -1,3 +1,3 @@
1
1
  module Moodle2CC
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -528,6 +528,26 @@
528
528
  <BLOCKAFTER>0</BLOCKAFTER>
529
529
  <BLOCKPERIOD>0</BLOCKPERIOD>
530
530
  </MOD>
531
+ <MOD>
532
+ <ID>766</ID>
533
+ <MODTYPE>hsuforum</MODTYPE>
534
+ <TYPE>news</TYPE>
535
+ <NAME>Announcements</NAME>
536
+ <INTRO>General news and announcements</INTRO>
537
+ <ASSESSED>0</ASSESSED>
538
+ <ASSESSTIMESTART>0</ASSESSTIMESTART>
539
+ <ASSESSTIMEFINISH>0</ASSESSTIMEFINISH>
540
+ <MAXBYTES>0</MAXBYTES>
541
+ <SCALE>0</SCALE>
542
+ <FORCESUBSCRIBE>1</FORCESUBSCRIBE>
543
+ <TRACKINGTYPE>1</TRACKINGTYPE>
544
+ <RSSTYPE>0</RSSTYPE>
545
+ <RSSARTICLES>0</RSSARTICLES>
546
+ <TIMEMODIFIED>1338472516</TIMEMODIFIED>
547
+ <WARNAFTER>0</WARNAFTER>
548
+ <BLOCKAFTER>0</BLOCKAFTER>
549
+ <BLOCKPERIOD>0</BLOCKPERIOD>
550
+ </MOD>
531
551
  <MOD>
532
552
  <ID>654</ID>
533
553
  <MODTYPE>label</MODTYPE>
@@ -125,7 +125,7 @@ class TestUnitCanvasQuestion < MiniTest::Unit::TestCase
125
125
  @question.text = "How much is {a} + {b} ?"
126
126
  @question.image = "test.jpg"
127
127
  question = Moodle2CC::Canvas::Question.new @question
128
- assert_equal %{<img src="$IMS_CC_FILEBASE$/test.jpg" alt="test.jpg"/>How much is [a] + [b] ?}, question.material
128
+ assert_equal %{How much is [a] + [b] ?<p><img src="$IMS_CC_FILEBASE$/test.jpg" alt="test.jpg"/></p>}, question.material
129
129
  end
130
130
 
131
131
  def test_it_converts_markdown_text_to_html_material
@@ -403,7 +403,7 @@ class TestUnitCanvasQuestion < MiniTest::Unit::TestCase
403
403
  assert xml.root.xpath('itemmetadata/qtimetadata/qtimetadatafield[fieldlabel="points_possible" and fieldentry="1"]').first, 'does not have meta data for points possible'
404
404
  assert xml.root.xpath('itemmetadata/qtimetadata/qtimetadatafield[fieldlabel="assessment_question_identifierref" and fieldentry="i04823ed56ffd4fd5f9c21db0cf25be6c"]').first, 'does not have meta data for assessment_question_identifierref'
405
405
 
406
- assert_equal %{<img src="$IMS_CC_FILEBASE$/test.jpg" alt="test.jpg"/>How much is [a] + [b] ?}, xml.root.xpath('presentation/material/mattext[@texttype="text/html"]').text
406
+ assert_equal %{How much is [a] + [b] ?<p><img src="$IMS_CC_FILEBASE$/test.jpg" alt="test.jpg"/></p>}, xml.root.xpath('presentation/material/mattext[@texttype="text/html"]').text
407
407
 
408
408
  # Score
409
409
  outcome = xml.root.xpath('resprocessing/outcomes/decvar').first
@@ -24,47 +24,47 @@ class TestUnitMoodleMod < MiniTest::Unit::TestCase
24
24
  end
25
25
 
26
26
  def test_it_has_all_the_mods
27
- assert_equal 14, @mods.length
27
+ assert_equal 15, @mods.length
28
28
  end
29
29
 
30
30
  def test_it_has_an_id
31
- assert_equal 987, @mods[0].id
31
+ assert_equal 987, @mods.find{|m| m.id == 987}.id
32
32
  end
33
33
 
34
34
  def test_it_has_an_var1
35
- assert_equal 0, @mods[0].var1
35
+ assert_equal 0, @mods.find{|m| m.id == 987}.var1
36
36
  end
37
37
 
38
38
  def test_it_has_an_var2
39
- assert_equal 1, @mods[0].var2
39
+ assert_equal 1, @mods.find{|m| m.id == 987}.var2
40
40
  end
41
41
 
42
42
  def test_it_has_an_var3
43
- assert_equal 2, @mods[0].var3
43
+ assert_equal 2, @mods.find{|m| m.id == 987}.var3
44
44
  end
45
45
 
46
46
  def test_it_has_an_var4
47
- assert_equal 3, @mods[0].var4
47
+ assert_equal 3, @mods.find{|m| m.id == 987}.var4
48
48
  end
49
49
 
50
50
  def test_it_has_an_var5
51
- assert_equal 4, @mods[0].var5
51
+ assert_equal 4, @mods.find{|m| m.id == 987}.var5
52
52
  end
53
53
 
54
54
  def test_it_has_a_mod_type
55
- assert_equal "assignment", @mods[0].mod_type
55
+ assert_equal "assignment", @mods.find{|m| m.id == 987}.mod_type
56
56
  end
57
57
 
58
58
  def test_it_has_a_type
59
- assert_equal "file", @mods[1].type
59
+ assert_equal "file", @mods.find{|m| m.id == 876}.type
60
60
  end
61
61
 
62
62
  def test_it_has_a_name
63
- assert_equal "Create a Rails site", @mods[0].name
63
+ assert_equal "Create a Rails site", @mods.find{|m| m.id == 987}.name
64
64
  end
65
65
 
66
66
  def test_it_has_a_description
67
- assert_equal "<h1>Hello World</h1>", @mods[0].description
67
+ assert_equal "<h1>Hello World</h1>", @mods.find{|m| m.id == 987}.description
68
68
  end
69
69
 
70
70
  def test_it_has_a_summary
@@ -72,23 +72,23 @@ class TestUnitMoodleMod < MiniTest::Unit::TestCase
72
72
  end
73
73
 
74
74
  def test_it_has_content
75
- assert_equal "Section 1", @mods[3].content
75
+ assert_equal "Section 1", @mods.find{|m| m.id == 654}.content
76
76
  end
77
77
 
78
78
  def test_it_has_an_assignment_type
79
- assert_equal "offline", @mods[0].assignment_type
79
+ assert_equal "offline", @mods.find{|m| m.id == 987}.assignment_type
80
80
  end
81
81
 
82
82
  def test_it_has_a_resubmit
83
- assert_equal false, @mods[0].resubmit
83
+ assert_equal false, @mods.find{|m| m.id == 987}.resubmit
84
84
  end
85
85
 
86
86
  def test_it_has_a_prevent_late
87
- assert_equal true, @mods[0].prevent_late
87
+ assert_equal true, @mods.find{|m| m.id == 987}.prevent_late
88
88
  end
89
89
 
90
90
  def test_it_has_a_grade
91
- assert_equal 5, @mods[0].grade
91
+ assert_equal 5, @mods.find{|m| m.id == 987}.grade
92
92
  end
93
93
 
94
94
  def test_it_has_number_of_attachments
@@ -120,23 +120,23 @@ class TestUnitMoodleMod < MiniTest::Unit::TestCase
120
120
  end
121
121
 
122
122
  def test_it_has_a_time_due
123
- assert_equal 1355356740, @mods[0].time_due
123
+ assert_equal 1355356740, @mods.find{|m| m.id == 987}.time_due
124
124
  end
125
125
 
126
126
  def test_it_has_a_time_available
127
- assert_equal 1355314332, @mods[0].time_available
127
+ assert_equal 1355314332, @mods.find{|m| m.id == 987}.time_available
128
128
  end
129
129
 
130
130
  def test_it_has_a_reference
131
- assert_equal "http://en.wikipedia.org/wiki/Einstein", @mods[1].reference
131
+ assert_equal "http://en.wikipedia.org/wiki/Einstein", @mods.find{|m| m.id == 876}.reference
132
132
  end
133
133
 
134
134
  def test_it_has_an_intro
135
- assert_equal "General news and announcements", @mods[2].intro
135
+ assert_equal "General news and announcements", @mods.find{|m| m.id == 765}.intro
136
136
  end
137
137
 
138
138
  def test_it_has_alltext
139
- assert_equal "<p><strong> Instructor Resources </strong></p>", @mods[4].alltext
139
+ assert_equal "<p><strong> Instructor Resources </strong></p>", @mods.find{|m| m.id == 543}.alltext
140
140
  end
141
141
 
142
142
  def test_it_has_text
@@ -290,7 +290,7 @@ class TestUnitMoodleMod < MiniTest::Unit::TestCase
290
290
  end
291
291
 
292
292
  def test_it_has_section_mods
293
- assert_equal @course.sections.first.mods[1], @mods[0].section_mod
293
+ assert_equal @course.sections.first.mods[1], @mods.find{|m| m.id == 987}.section_mod
294
294
  end
295
295
 
296
296
  def test_it_has_a_grade_item
@@ -40,6 +40,13 @@ class TestUnitCCResource < MiniTest::Unit::TestCase
40
40
 
41
41
  resource = @canvas_factory.get_resource_from_mod(mod)
42
42
  assert_kind_of Moodle2CC::Canvas::DiscussionTopic, resource
43
+
44
+ mod = @backup.course.mods.find { |m| m.mod_type == "hsuforum" }
45
+ resource = @cc_factory.get_resource_from_mod(mod)
46
+ assert_kind_of Moodle2CC::CC::DiscussionTopic, resource
47
+
48
+ resource = @canvas_factory.get_resource_from_mod(mod)
49
+ assert_kind_of Moodle2CC::Canvas::DiscussionTopic, resource
43
50
  end
44
51
 
45
52
  def test_it_can_get_web_content_resource_from_text_resource
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.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-06-27 00:00:00.000000000 Z
14
+ date: 2013-07-02 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rubyzip