canvas_qti_to_learnosity_converter 2.3.0 → 2.4.1
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: 6c158942ecdb0d9e37f54528a9d2411d61827f2fc29eb7bfd9fea84cb41cfd7a
|
4
|
+
data.tar.gz: f3073a832eee1b03125af16da109b4c4c9c419ac5dc9889435b1c591212d8b87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de9f66b8dadb1c51c19733af8ca8f1bfd2e7317c215b3249a370da1bed63ce3aea7197b1a401101c3074f9819af77135dcd9605334d13f2227ec913f3c205f59
|
7
|
+
data.tar.gz: 13bcaf6c6b73156f88929eb384e9d5e571144b505770eabedd1071be4de9c40ebad2befe0e2f19e8b9242014a7788c297fc4901ac5a19401ec2b201ac3def082
|
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 = URI.unescape(asset_path)
|
86
|
+
text.scan(/(%24|\$)IMS-CC-FILEBASE\1\/([^"]+)/) do |_delimiter, asset_path|
|
87
|
+
decoded_path = URI::DEFAULT_PARSER.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.1
|
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: 2023-09-21 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.4.10
|
151
|
+
signing_key:
|
153
152
|
specification_version: 4
|
154
153
|
summary: Converts canvas qti to learnosity JSON
|
155
154
|
test_files: []
|