moodle2cc 0.2.9 → 0.2.10

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MGZkMWM1ODcxZGM3NzlkMTg2NmYzZjE0YTUzYTU4ODQxOGExZjQ5NQ==
4
+ NmY2ODJmNDFmYWI4NzNlNWE3MWM4ZTFlMmE4Y2Y2YTk4YjljZWRiOA==
5
5
  data.tar.gz: !binary |-
6
- Yzc3M2I1MWI1MzljZWFkMTM2YzI1YzFkODRmMzJkZDM5ZGYwZDc4Yg==
6
+ NjQ2ZDlhOTc4NDcxYzY0NDdiZmEyNDcyZGI0MzY1ZjBiZWM5ZDUzMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDg2MmRjMmExMTUwM2NmMmEyMGY1NzNlZDgwZmZhM2Y0ZDJlYjAzNTBmM2Nh
10
- ODJiZmM4YWY0OWI2YWYxNjcyZDQ4MWZjZjk0NTRhMmQ3ZjE4MTM0ZDAxNjE1
11
- NGJhODA5MGQ4MjU1N2RjZDlhYzRlZDczM2JhYjQ0N2ZjMzU3MTI=
9
+ ZjI4M2FmYzQ1NmQ5NWJhMzExOTY5ZTViYTYxYmUyNjJmNWQ2ODgzODA1YzAx
10
+ YWMzNzJmNGY2MTI0YzkwNjRkODVhNjZiYWZlNzRhMWVmN2NhMWZhOGQwNzNl
11
+ N2M4NmFkNGJhODZmZWI1NGQzMTcwZWNlY2Y3Njc2N2NkN2EzY2Y=
12
12
  data.tar.gz: !binary |-
13
- Nzc1YWExZGQ4YjhmNjJkNTBjZTM2M2I0OWYxMThhMjEzZGIyZGI0ODMzN2M4
14
- NGZkYjU2NWE3Zjg3NTE3ZWYzMGUyMzUwNzk4NWY0MmE4MDNlOGRjNWQyNDE5
15
- MTE5MTBhZjI3M2E5MTFkM2YxM2ZmNjYwNDgxZTA1NDA2MzJhNTg=
13
+ NTM4YjMwODIwNmQ4MWZkNzk0NGQyZGExMjNhMzdmMDRjZGJkMmE3MWMyMDEy
14
+ MTg5MGRmODA0MjExNDNlZGRhYjE1MWU5YTAzZGVjYWJlYjNkMzg5ZjYwYjhm
15
+ NDA1NjdkMzA3NGMyNTk4MzFmMTRjNzU4ZmQyMzdkNmQ3NWVhM2U=
data/Changelog CHANGED
@@ -1,3 +1,7 @@
1
+ 2014-06-19 Version 0.2.10
2
+ * Require students to post before viewing converted Q & A forums
3
+ * Convert multiple attempts settings from feedback activites
4
+
1
5
  2014-06-05 Version 0.2.9
2
6
  * Minor fixes for multi-answer and html conversion
3
7
 
@@ -42,6 +42,7 @@ module Moodle2CC::CanvasCC
42
42
  xml.position
43
43
  xml.type 'topic'
44
44
  xml.discussion_type discussion.discussion_type
45
+ xml.require_initial_post discussion.require_initial_post
45
46
  }
46
47
  end.to_xml
47
48
  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
3
+ attr_accessor :identifier, :title, :text, :discussion_type, :workflow_state, :require_initial_post
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 Feedback
3
3
 
4
4
  attr_accessor :id, :module_id, :name, :intro, :intro_format, :time_open, :time_close,
5
- :time_modified, :items, :visible
5
+ :time_modified, :items, :visible, :multiple_submit
6
6
 
7
7
  def initialize
8
8
  @items = []
@@ -4,6 +4,7 @@ module Moodle2CC::Moodle2::Models::Quizzes
4
4
  attr_accessor :embedded_question_references, :embedded_questions
5
5
 
6
6
  def initialize
7
+ super
7
8
  @embedded_questions = []
8
9
  end
9
10
 
@@ -32,6 +32,8 @@ module Moodle2CC::Moodle2::Parsers
32
32
  feedback.time_close = parse_text(xml, '/activity/feedback/timeclose')
33
33
  feedback.time_modified = parse_text(xml, '/activity/feedback/timemodified')
34
34
 
35
+ feedback.multiple_submit = parse_boolean(xml, '/activity/feedback/multiple_submit')
36
+
35
37
  xml.search('/activity/feedback/items/item').each do |node|
36
38
  item = Moodle2CC::Moodle2::Models::Feedback::Question.new
37
39
  item.id = node.attributes['id'].value
@@ -10,7 +10,7 @@ module Moodle2CC::Moodle2Converter
10
10
  discussion.text = forum.intro
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
14
  discussion
15
15
  end
16
16
 
@@ -15,6 +15,8 @@ module Moodle2CC::Moodle2Converter
15
15
  canvas_assessment.scoring_policy = 'keep_latest'
16
16
  canvas_assessment.quiz_type = 'survey'
17
17
 
18
+ canvas_assessment.allowed_attempts = -1 if moodle_feedback.multiple_submit
19
+
18
20
  canvas_assessment.items = []
19
21
  moodle_feedback.items.each do |item|
20
22
  if canvas_question = convert_feedback_question(item)
@@ -1,3 +1,3 @@
1
1
  module Moodle2CC
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.10"
3
3
  end
@@ -6,7 +6,7 @@ module Moodle2CC::Moodle2::Models::Quizzes
6
6
  it_behaves_like 'a Moodle2CC::Moodle2::Models::Quizzes::Question'
7
7
 
8
8
  it_behaves_like 'it has an attribute for', :embedded_question_references
9
- it_behaves_like 'it has an attribute for', :embedded_questions
9
+ it_behaves_like 'it has an attribute for', :embedded_questions, []
10
10
 
11
11
  it_behaves_like 'it is registered as a Question', 'multianswer'
12
12
 
@@ -5,10 +5,8 @@ describe Moodle2CC::Moodle2::Parsers::FeedbackParser do
5
5
 
6
6
  it 'should parse a feedback activity' do
7
7
  feedbacks = subject.parse
8
- expect(feedbacks.count).to eq 1
9
- feedback = feedbacks.first
10
-
11
- expect(feedback.id).to eq '7'
8
+ expect(feedbacks.count).to eq 2
9
+ feedback = feedbacks.detect{|f| f.id == '7'}
12
10
 
13
11
  expect(feedback.module_id).to eq '58588'
14
12
  expect(feedback.name).to eq 'feedback name'
@@ -17,6 +15,7 @@ describe Moodle2CC::Moodle2::Parsers::FeedbackParser do
17
15
  expect(feedback.time_close).to eq '0'
18
16
  expect(feedback.time_open).to eq '0'
19
17
  expect(feedback.time_modified).to eq '1397566320'
18
+ expect(feedback.multiple_submit).to eq false
20
19
 
21
20
  expect(feedback.items.count).to eq 9
22
21
  item = feedback.items.last
@@ -26,6 +25,9 @@ describe Moodle2CC::Moodle2::Parsers::FeedbackParser do
26
25
  expect(item.position).to eq '9'
27
26
  expect(item.type).to eq 'textfield'
28
27
  expect(item.presentation).to eq '30|5'
28
+
29
+ feedback2 = feedbacks.detect{|f| f.id == '8'}
30
+ expect(feedback2.multiple_submit).to eq true
29
31
  end
30
32
 
31
33
  end
@@ -9,6 +9,7 @@ describe DiscussionConverter do
9
9
  forum.name = 'Forum Name'
10
10
  forum.intro = 'Forum Introduction'
11
11
  forum.visible = false
12
+ forum.type = 'qanda'
12
13
 
13
14
  discussion = subject.convert(forum)
14
15
 
@@ -17,7 +18,11 @@ describe DiscussionConverter do
17
18
  expect(discussion.text).to eq 'Forum Introduction'
18
19
  expect(discussion.discussion_type).to eq 'threaded'
19
20
  expect(discussion.workflow_state).to eq 'unpublished'
21
+ expect(discussion.require_initial_post).to eq true
20
22
 
23
+ forum.type = 'general'
24
+ discussion2 = subject.convert(forum)
25
+ expect(discussion2.require_initial_post).to eq false
21
26
  end
22
27
  end
23
28
  end
@@ -0,0 +1,147 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <activity id="8" moduleid="58589" modulename="feedback" contextid="162391">
3
+ <feedback id="8">
4
+ <name>feedback name</name>
5
+ <intro>&lt;p&gt;feedback description&lt;/p&gt;</intro>
6
+ <introformat>1</introformat>
7
+ <anonymous>1</anonymous>
8
+ <email_notification>0</email_notification>
9
+ <multiple_submit>1</multiple_submit>
10
+ <autonumbering>0</autonumbering>
11
+ <site_after_submit></site_after_submit>
12
+ <page_after_submit></page_after_submit>
13
+ <page_after_submitformat>1</page_after_submitformat>
14
+ <publish_stats>0</publish_stats>
15
+ <timeopen>0</timeopen>
16
+ <timeclose>0</timeclose>
17
+ <timemodified>1397566320</timemodified>
18
+ <completionsubmit>0</completionsubmit>
19
+ <items>
20
+ <item id="123">
21
+ <template>0</template>
22
+ <name>Captcha</name>
23
+ <label>Captcha</label>
24
+ <presentation></presentation>
25
+ <typ>captcha</typ>
26
+ <hasvalue>0</hasvalue>
27
+ <position>1</position>
28
+ <required>1</required>
29
+ <dependitem>0</dependitem>
30
+ <dependvalue></dependvalue>
31
+ <options></options>
32
+ </item>
33
+ <item id="124">
34
+ <template>0</template>
35
+ <name>Information question</name>
36
+ <label>informationlabel</label>
37
+ <presentation>3</presentation>
38
+ <typ>info</typ>
39
+ <hasvalue>1</hasvalue>
40
+ <position>2</position>
41
+ <required>0</required>
42
+ <dependitem>0</dependitem>
43
+ <dependvalue></dependvalue>
44
+ <options></options>
45
+ </item>
46
+ <item id="125">
47
+ <template>0</template>
48
+ <name>label</name>
49
+ <label></label>
50
+ <presentation>&lt;p&gt;Label "question"&lt;/p&gt;</presentation>
51
+ <typ>label</typ>
52
+ <hasvalue>0</hasvalue>
53
+ <position>3</position>
54
+ <required>0</required>
55
+ <dependitem>0</dependitem>
56
+ <dependvalue></dependvalue>
57
+ <options></options>
58
+ </item>
59
+ <item id="126">
60
+ <template>0</template>
61
+ <name></name>
62
+ <label></label>
63
+ <presentation></presentation>
64
+ <typ>pagebreak</typ>
65
+ <hasvalue>0</hasvalue>
66
+ <position>4</position>
67
+ <required>0</required>
68
+ <dependitem>0</dependitem>
69
+ <dependvalue></dependvalue>
70
+ <options></options>
71
+ </item>
72
+ <item id="127">
73
+ <template>0</template>
74
+ <name>longer text answer</name>
75
+ <label>longertextanswerlabel</label>
76
+ <presentation>30|5</presentation>
77
+ <typ>textarea</typ>
78
+ <hasvalue>1</hasvalue>
79
+ <position>5</position>
80
+ <required>0</required>
81
+ <dependitem>0</dependitem>
82
+ <dependvalue></dependvalue>
83
+ <options></options>
84
+ </item>
85
+ <item id="128">
86
+ <template>0</template>
87
+ <name>multiple choice question</name>
88
+ <label>multiplechoicelabel</label>
89
+ <presentation>r&gt;&gt;&gt;&gt;&gt;Option 1
90
+ |Option 2
91
+ |Option 3</presentation>
92
+ <typ>multichoice</typ>
93
+ <hasvalue>1</hasvalue>
94
+ <position>6</position>
95
+ <required>0</required>
96
+ <dependitem>0</dependitem>
97
+ <dependvalue></dependvalue>
98
+ <options></options>
99
+ </item>
100
+ <item id="129">
101
+ <template>0</template>
102
+ <name>multiple choice rated</name>
103
+ <label>ratedlabel</label>
104
+ <presentation>r&gt;&gt;&gt;&gt;&gt;1####Something
105
+ |2####something else
106
+ |3####something something else</presentation>
107
+ <typ>multichoicerated</typ>
108
+ <hasvalue>1</hasvalue>
109
+ <position>7</position>
110
+ <required>0</required>
111
+ <dependitem>0</dependitem>
112
+ <dependvalue></dependvalue>
113
+ <options></options>
114
+ </item>
115
+ <item id="130">
116
+ <template>0</template>
117
+ <name>numeric question</name>
118
+ <label>numbericquestisonlabel</label>
119
+ <presentation>1|100</presentation>
120
+ <typ>numeric</typ>
121
+ <hasvalue>1</hasvalue>
122
+ <position>8</position>
123
+ <required>0</required>
124
+ <dependitem>0</dependitem>
125
+ <dependvalue></dependvalue>
126
+ <options></options>
127
+ </item>
128
+ <item id="131">
129
+ <template>0</template>
130
+ <name>short text question</name>
131
+ <label>shorttextlabel</label>
132
+ <presentation>30|5</presentation>
133
+ <typ>textfield</typ>
134
+ <hasvalue>1</hasvalue>
135
+ <position>9</position>
136
+ <required>0</required>
137
+ <dependitem>0</dependitem>
138
+ <dependvalue></dependvalue>
139
+ <options></options>
140
+ </item>
141
+ </items>
142
+ <completeds>
143
+ </completeds>
144
+ <trackings>
145
+ </trackings>
146
+ </feedback>
147
+ </activity>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <filters>
3
+ <filter_actives>
4
+ </filter_actives>
5
+ <filter_configs>
6
+ </filter_configs>
7
+ </filters>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <activity_gradebook>
3
+ <grade_items>
4
+ </grade_items>
5
+ <grade_letters>
6
+ </grade_letters>
7
+ </activity_gradebook>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <inforef>
3
+ </inforef>
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module id="58588" version="2013050100">
3
+ <modulename>feedback</modulename>
4
+ <sectionid>34361</sectionid>
5
+ <sectionnumber>2</sectionnumber>
6
+ <idnumber>$@NULL@$</idnumber>
7
+ <added>1397566320</added>
8
+ <score>0</score>
9
+ <indent>0</indent>
10
+ <visible>1</visible>
11
+ <visibleold>1</visibleold>
12
+ <groupmode>0</groupmode>
13
+ <groupingid>0</groupingid>
14
+ <groupmembersonly>0</groupmembersonly>
15
+ <completion>1</completion>
16
+ <completiongradeitemnumber>$@NULL@$</completiongradeitemnumber>
17
+ <completionview>0</completionview>
18
+ <completionexpected>0</completionexpected>
19
+ <availablefrom>0</availablefrom>
20
+ <availableuntil>0</availableuntil>
21
+ <releasecode>code</releasecode>
22
+ <showavailability>1</showavailability>
23
+ <showdescription>0</showdescription>
24
+ <plugin_outcomesupport_mod_module>
25
+ </plugin_outcomesupport_mod_module>
26
+ <availability_info>
27
+ </availability_info>
28
+ </module>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <roles>
3
+ <role_overrides>
4
+ </role_overrides>
5
+ <role_assignments>
6
+ </role_assignments>
7
+ </roles>
@@ -127,6 +127,13 @@
127
127
  <title>feedback name</title>
128
128
  <directory>activities/feedback_58588</directory>
129
129
  </activity>
130
+ <activity>
131
+ <moduleid>58589</moduleid>
132
+ <sectionid>7</sectionid>
133
+ <modulename>feedback</modulename>
134
+ <title>feedback name</title>
135
+ <directory>activities/feedback_58589</directory>
136
+ </activity>
130
137
  <activity>
131
138
  <moduleid>58541</moduleid>
132
139
  <sectionid>7</sectionid>
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.9
4
+ version: 0.2.10
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-06-05 00:00:00.000000000 Z
13
+ date: 2014-06-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubyzip
@@ -580,6 +580,12 @@ files:
580
580
  - test/fixtures/moodle2/backup/activities/feedback_58588/inforef.xml
581
581
  - test/fixtures/moodle2/backup/activities/feedback_58588/module.xml
582
582
  - test/fixtures/moodle2/backup/activities/feedback_58588/roles.xml
583
+ - test/fixtures/moodle2/backup/activities/feedback_58589/feedback.xml
584
+ - test/fixtures/moodle2/backup/activities/feedback_58589/filters.xml
585
+ - test/fixtures/moodle2/backup/activities/feedback_58589/grades.xml
586
+ - test/fixtures/moodle2/backup/activities/feedback_58589/inforef.xml
587
+ - test/fixtures/moodle2/backup/activities/feedback_58589/module.xml
588
+ - test/fixtures/moodle2/backup/activities/feedback_58589/roles.xml
583
589
  - test/fixtures/moodle2/backup/activities/folder_7/calendar.xml
584
590
  - test/fixtures/moodle2/backup/activities/folder_7/comments.xml
585
591
  - test/fixtures/moodle2/backup/activities/folder_7/completion.xml
@@ -816,7 +822,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
816
822
  version: '0'
817
823
  requirements: []
818
824
  rubyforge_project:
819
- rubygems_version: 2.2.1
825
+ rubygems_version: 2.3.0
820
826
  signing_key:
821
827
  specification_version: 4
822
828
  summary: Migrates Moodle backup ZIP to IMS Common Cartridge package
@@ -991,6 +997,12 @@ test_files:
991
997
  - test/fixtures/moodle2/backup/activities/feedback_58588/inforef.xml
992
998
  - test/fixtures/moodle2/backup/activities/feedback_58588/module.xml
993
999
  - test/fixtures/moodle2/backup/activities/feedback_58588/roles.xml
1000
+ - test/fixtures/moodle2/backup/activities/feedback_58589/feedback.xml
1001
+ - test/fixtures/moodle2/backup/activities/feedback_58589/filters.xml
1002
+ - test/fixtures/moodle2/backup/activities/feedback_58589/grades.xml
1003
+ - test/fixtures/moodle2/backup/activities/feedback_58589/inforef.xml
1004
+ - test/fixtures/moodle2/backup/activities/feedback_58589/module.xml
1005
+ - test/fixtures/moodle2/backup/activities/feedback_58589/roles.xml
994
1006
  - test/fixtures/moodle2/backup/activities/folder_7/calendar.xml
995
1007
  - test/fixtures/moodle2/backup/activities/folder_7/comments.xml
996
1008
  - test/fixtures/moodle2/backup/activities/folder_7/completion.xml