canvas_qti_to_learnosity_converter 2.2.0 → 2.3.0
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,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0867de4ed2c5e63c40847682b28902912b7feec791671ce552dd0ab10081e2ce'
|
4
|
+
data.tar.gz: 51897841e676a4aa65b9f46535844f9240b48df054cba20ab622aa83311411c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9139a5fd21f743f3533a04e7e72519ba0bd3b3cda66436364a944a94cf83f6f14bdc55aa4e7cc5b65d26ca69669f52f1ee0c1b91d4663963f3852936c849afce
|
7
|
+
data.tar.gz: 3fb5146135643b8c7f1e3101b28147ca22e4271cd069e893aa9874aa1c210ec0d8b7aca68bceefcb79d10478f9bd452889120b0ad6c50a583a61e81d178bfc89
|
@@ -45,6 +45,11 @@ module CanvasQtiToLearnosityConverter
|
|
45
45
|
}
|
46
46
|
|
47
47
|
class CanvasQuestionTypeNotSupportedError < RuntimeError
|
48
|
+
attr_reader :question_type
|
49
|
+
def initialize(question_type)
|
50
|
+
@question_type = question_type.to_s
|
51
|
+
super("Unsupported question type #{@question_type}")
|
52
|
+
end
|
48
53
|
end
|
49
54
|
|
50
55
|
class CanvasQtiQuiz
|
@@ -106,7 +111,7 @@ module CanvasQtiToLearnosityConverter
|
|
106
111
|
if question_class
|
107
112
|
question = question_class.new(xml)
|
108
113
|
else
|
109
|
-
raise CanvasQuestionTypeNotSupportedError
|
114
|
+
raise CanvasQuestionTypeNotSupportedError.new(type)
|
110
115
|
end
|
111
116
|
|
112
117
|
[learnosity_type, question]
|
@@ -116,11 +121,12 @@ module CanvasQtiToLearnosityConverter
|
|
116
121
|
title.gsub(/["']/, "")
|
117
122
|
end
|
118
123
|
|
119
|
-
def self.convert(qti, assets)
|
124
|
+
def self.convert(qti, assets, errors)
|
120
125
|
quiz = CanvasQtiQuiz.new(qti_string: qti)
|
121
126
|
assessment = quiz.css("assessment")
|
122
127
|
ident = assessment.attribute("ident").value
|
123
128
|
assets[ident] = {}
|
129
|
+
errors[ident] = []
|
124
130
|
|
125
131
|
items = []
|
126
132
|
|
@@ -138,8 +144,19 @@ module CanvasQtiToLearnosityConverter
|
|
138
144
|
path = [items.count - 1, :data]
|
139
145
|
|
140
146
|
quiz_item.add_learnosity_assets(assets[ident], path)
|
141
|
-
rescue CanvasQuestionTypeNotSupportedError
|
142
|
-
|
147
|
+
rescue CanvasQuestionTypeNotSupportedError => e
|
148
|
+
errors[ident].push({
|
149
|
+
index: index,
|
150
|
+
error_type: "unsupported_question",
|
151
|
+
question_type: e.question_type.to_s,
|
152
|
+
message: e.message,
|
153
|
+
})
|
154
|
+
rescue StandardError => e
|
155
|
+
errors[ident].push({
|
156
|
+
index: index,
|
157
|
+
error_type: e.class.to_s,
|
158
|
+
message: e.message,
|
159
|
+
})
|
143
160
|
end
|
144
161
|
end
|
145
162
|
|
@@ -172,14 +189,16 @@ module CanvasQtiToLearnosityConverter
|
|
172
189
|
paths = imscc_quiz_paths(parsed_manifest)
|
173
190
|
|
174
191
|
assets = {}
|
192
|
+
errors = {}
|
175
193
|
converted_assesments = paths.map do |qti_path|
|
176
194
|
qti = zip_file.find_entry(qti_path).get_input_stream.read
|
177
|
-
convert(qti, assets)
|
195
|
+
convert(qti, assets, errors)
|
178
196
|
end
|
179
197
|
|
180
198
|
{
|
181
199
|
assessments: converted_assesments,
|
182
200
|
assets: assets,
|
201
|
+
errors: errors,
|
183
202
|
}
|
184
203
|
end
|
185
204
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canvas_qti_to_learnosity_converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Atomic Jolt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-08-
|
12
|
+
date: 2018-08-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|