canvas_qti_to_learnosity_converter 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/canvas_qti_to_learnosity_converter.gemspec +1 -1
- data/lib/canvas_qti_to_learnosity_converter/convert.rb +4 -2
- data/lib/canvas_qti_to_learnosity_converter/questions/calculated.rb +1 -0
- data/lib/canvas_qti_to_learnosity_converter/questions/essay.rb +3 -0
- data/lib/canvas_qti_to_learnosity_converter/questions/file_upload.rb +3 -0
- data/lib/canvas_qti_to_learnosity_converter/questions/fill_the_blanks.rb +3 -2
- data/lib/canvas_qti_to_learnosity_converter/questions/matching.rb +14 -11
- data/lib/canvas_qti_to_learnosity_converter/questions/multiple_choice.rb +8 -2
- data/lib/canvas_qti_to_learnosity_converter/questions/multiple_dropdowns.rb +3 -1
- data/lib/canvas_qti_to_learnosity_converter/questions/numerical.rb +1 -0
- data/lib/canvas_qti_to_learnosity_converter/questions/question.rb +6 -0
- data/lib/canvas_qti_to_learnosity_converter/questions/short_answer.rb +2 -2
- data/lib/canvas_qti_to_learnosity_converter/version.rb +1 -1
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2f612956cbc00ab89e47a628c2c7d9007053f1533f5ec5cf5d6f6066b5d0b95
|
4
|
+
data.tar.gz: 196ec2ae80fee84fd92812a7d720218efc9219c7f97fb11c04b79681b093657f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8289a948c65d4506923e9097c1bfbef83cd1e7b89f2a2d80ce6bd86eb86b416948883ef81a693a574b09a4187d37c7a6fb73259e838c5a7296c917d952f78c65
|
7
|
+
data.tar.gz: 2a4a8d92ec9a9739cb4048c7698e61af46c0ad9691a4d154f49573c1ce6e38c3d0c3b12e25db1cea931c017303f58bd6b04afac42c58a34e1bfffcf235cbc208
|
data/.gitignore
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
end
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler", "~>
|
21
|
+
spec.add_development_dependency "bundler", "~> 2.3"
|
22
22
|
spec.add_development_dependency "byebug"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
spec.add_development_dependency "rspec", "~> 3.0"
|
@@ -83,8 +83,8 @@ module CanvasQtiToLearnosityConverter
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def self.add_files_to_assets(assets, path, text)
|
86
|
-
text.scan(
|
87
|
-
decoded_path =
|
86
|
+
text.scan(/(%24|\$)IMS-CC-FILEBASE\1\/([^"]+)/) do |_delimiter, asset_path|
|
87
|
+
decoded_path = CGI.unescape(asset_path)
|
88
88
|
assets[decoded_path] ||= []
|
89
89
|
assets[decoded_path].push(path)
|
90
90
|
end
|
@@ -132,9 +132,11 @@ module CanvasQtiToLearnosityConverter
|
|
132
132
|
|
133
133
|
quiz.css("item").each.with_index do |item, index|
|
134
134
|
begin
|
135
|
+
item_title = item.attribute("title").value
|
135
136
|
learnosity_type, quiz_item = convert_item(qti_string: item.to_html)
|
136
137
|
|
137
138
|
item = {
|
139
|
+
title: item_title,
|
138
140
|
type: learnosity_type,
|
139
141
|
data: quiz_item.to_learnosity,
|
140
142
|
dynamic_content_data: quiz_item.dynamic_content_data()
|
@@ -42,7 +42,8 @@ module CanvasQtiToLearnosityConverter
|
|
42
42
|
create_responses(responses, 0, all_responses, [])
|
43
43
|
|
44
44
|
{
|
45
|
-
"scoring_type" => "
|
45
|
+
"scoring_type" => "partialMatchV2",
|
46
|
+
"rounding" => "none",
|
46
47
|
"valid_response" => all_responses.shift,
|
47
48
|
"alt_responses" => all_responses
|
48
49
|
}
|
@@ -50,7 +51,7 @@ module CanvasQtiToLearnosityConverter
|
|
50
51
|
|
51
52
|
def create_responses(blank_responses, depth, result, current_response)
|
52
53
|
if depth == blank_responses.count
|
53
|
-
result.push({ "value" => current_response })
|
54
|
+
result.push({ "score" => extract_points_possible, "value" => current_response })
|
54
55
|
return
|
55
56
|
end
|
56
57
|
|
@@ -4,19 +4,20 @@ module CanvasQtiToLearnosityConverter
|
|
4
4
|
class MatchingQuestion < QuizQuestion
|
5
5
|
def to_learnosity
|
6
6
|
{
|
7
|
-
type: "
|
7
|
+
type: "clozedropdown",
|
8
8
|
stimulus: extract_stimulus(),
|
9
|
-
|
9
|
+
template: extract_template(),
|
10
10
|
validation: extract_validation(),
|
11
11
|
possible_responses: extract_responses(),
|
12
12
|
duplicate_responses: true,
|
13
|
+
shuffle_options: true,
|
13
14
|
}
|
14
15
|
end
|
15
16
|
|
16
|
-
def
|
17
|
+
def extract_template()
|
17
18
|
@xml.css("item > presentation > response_lid > material > mattext").map do |node|
|
18
|
-
extract_mattext(node)
|
19
|
-
end
|
19
|
+
"<p>#{extract_mattext(node)} {{response}}</p>"
|
20
|
+
end.join("\n")
|
20
21
|
end
|
21
22
|
|
22
23
|
def extract_response_idents()
|
@@ -48,18 +49,20 @@ module CanvasQtiToLearnosityConverter
|
|
48
49
|
end.flatten
|
49
50
|
|
50
51
|
{
|
51
|
-
"scoring_type" => "
|
52
|
+
"scoring_type" => "partialMatchV2",
|
53
|
+
"rounding" => "none",
|
52
54
|
"valid_response" => {
|
53
|
-
"value" => valid_responses
|
55
|
+
"value" => valid_responses,
|
56
|
+
"score" => extract_points_possible,
|
54
57
|
}
|
55
58
|
}
|
56
59
|
end
|
57
60
|
|
58
61
|
def extract_responses()
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
62
|
+
@xml.css("item > presentation > response_lid").map do |response|
|
63
|
+
response.css("response_label mattext").map do |node|
|
64
|
+
extract_mattext(node)
|
65
|
+
end
|
63
66
|
end
|
64
67
|
end
|
65
68
|
|
@@ -30,6 +30,7 @@ module CanvasQtiToLearnosityConverter
|
|
30
30
|
"scoring_type" => "exactMatch",
|
31
31
|
"valid_response" => {
|
32
32
|
"value" => [correct_value],
|
33
|
+
"score" => extract_points_possible,
|
33
34
|
},
|
34
35
|
}
|
35
36
|
end
|
@@ -81,8 +82,13 @@ module CanvasQtiToLearnosityConverter
|
|
81
82
|
and > varequal')
|
82
83
|
alt_responses = correct_condition.map(&:text)
|
83
84
|
{
|
84
|
-
"scoring_type" => "
|
85
|
-
"
|
85
|
+
"scoring_type" => "partialMatchV2",
|
86
|
+
"rounding" => "none",
|
87
|
+
"penalty" => extract_points_possible,
|
88
|
+
"valid_response" => {
|
89
|
+
"score" => extract_points_possible,
|
90
|
+
"value" => alt_responses,
|
91
|
+
},
|
86
92
|
}
|
87
93
|
end
|
88
94
|
end
|
@@ -28,9 +28,11 @@ module CanvasQtiToLearnosityConverter
|
|
28
28
|
end.flatten
|
29
29
|
|
30
30
|
{
|
31
|
-
"scoring_type" => "
|
31
|
+
"scoring_type" => "partialMatchV2",
|
32
|
+
"rounding" => "none",
|
32
33
|
"valid_response" => {
|
33
34
|
"value" => valid_responses,
|
35
|
+
"score" => extract_points_possible,
|
34
36
|
}
|
35
37
|
}
|
36
38
|
end
|
@@ -14,6 +14,12 @@ module CanvasQtiToLearnosityConverter
|
|
14
14
|
extract_mattext(mattext)
|
15
15
|
end
|
16
16
|
|
17
|
+
def extract_points_possible
|
18
|
+
@xml.css(%{ item > itemmetadata > qtimetadata >
|
19
|
+
qtimetadatafield > fieldlabel:contains("points_possible")})
|
20
|
+
&.first&.next&.text&.to_f || 1.0
|
21
|
+
end
|
22
|
+
|
17
23
|
def extract_mattext(mattext_node)
|
18
24
|
mattext_node.content
|
19
25
|
end
|
@@ -20,11 +20,11 @@ module CanvasQtiToLearnosityConverter
|
|
20
20
|
def extract_validation()
|
21
21
|
correct_responses = @xml.css('item > resprocessing >
|
22
22
|
respcondition[continue="No"] > conditionvar > varequal')
|
23
|
-
correct_response = { "value" => correct_responses.shift.text }
|
23
|
+
correct_response = { "value" => correct_responses.shift.text, "score" => extract_points_possible}
|
24
24
|
{
|
25
25
|
"scoring_type" => "exactMatch",
|
26
26
|
"valid_response" => correct_response,
|
27
|
-
"alt_responses" => correct_responses.map { |res| { "value" => res.text } }
|
27
|
+
"alt_responses" => correct_responses.map { |res| { "value" => res.text, "score" => extract_points_possible } }
|
28
28
|
}
|
29
29
|
end
|
30
30
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
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.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Atomic Jolt
|
8
8
|
- Nick Benoit
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-10-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '2.3'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '2.3'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: byebug
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
|
-
description:
|
98
|
+
description:
|
99
99
|
email:
|
100
100
|
- support@atomicjolt.com
|
101
101
|
executables: []
|
@@ -132,7 +132,7 @@ homepage: https://github.com/atomicjolt/qti_to_learnosity_converter
|
|
132
132
|
licenses:
|
133
133
|
- MIT
|
134
134
|
metadata: {}
|
135
|
-
post_install_message:
|
135
|
+
post_install_message:
|
136
136
|
rdoc_options: []
|
137
137
|
require_paths:
|
138
138
|
- lib
|
@@ -147,9 +147,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
|
-
|
151
|
-
|
152
|
-
signing_key:
|
150
|
+
rubygems_version: 3.3.15
|
151
|
+
signing_key:
|
153
152
|
specification_version: 4
|
154
153
|
summary: Converts canvas qti to learnosity JSON
|
155
154
|
test_files: []
|