atomic_assessments_import 0.4.0 → 0.5.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: 740e357d78824b877aecc7eef6c09f10f86be1def30d98cea1a27723a704af3d
|
|
4
|
+
data.tar.gz: 131ecc48cad43a3a93e629f2c80e99cc325028fdfa4be805a35c14cf09358396
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 638c7d61f679a330beb5e68965954bfd89db42c789e3ce59fb9bf1748d24d133a3f059a0e497f76e8a89b06b9fa2252ebe5927cb5dff95c0c68c2d5720919b9a
|
|
7
|
+
data.tar.gz: 6d92c1effa6b4b9856d33d3a92db74e3b0ed048b811f36bc799430f0d477ccc2637d2611dc4e770b414726fbba1789b0d902b6456ac2839cb7815477fccbf840
|
data/README.md
CHANGED
|
@@ -4,6 +4,7 @@ Import converters for atomic assessments. Currently this GEM supports the follo
|
|
|
4
4
|
* CSV
|
|
5
5
|
- Multiple Choice
|
|
6
6
|
* ExamSoft (in RTF, HTML, or DOCX file format)
|
|
7
|
+
- Each imported file produces one Learnosity activity containing its questions in order (titled from the exam header when present, else the file name)
|
|
7
8
|
- Multiple Choice
|
|
8
9
|
- True/False
|
|
9
10
|
- Fill in the Blank / Cloze
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "pandoc-ruby"
|
|
4
4
|
require "nokogiri"
|
|
5
|
+
require "securerandom"
|
|
5
6
|
require "active_support/core_ext/digest/uuid"
|
|
6
7
|
|
|
7
8
|
require_relative "../questions/question"
|
|
@@ -36,10 +37,12 @@ module AtomicAssessmentsImport
|
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
# Log header info if present
|
|
40
|
+
header_text = nil
|
|
39
41
|
unless chunk_result[:header_nodes].empty?
|
|
40
42
|
header_text = chunk_result[:header_nodes].map { |n| n.text.strip }.join(" ")
|
|
41
43
|
all_warnings << build_warning("Exam header detected: #{header_text}") unless header_text.empty?
|
|
42
44
|
end
|
|
45
|
+
activity_title = header_text&.strip&.presence || fallback_title
|
|
43
46
|
|
|
44
47
|
items = []
|
|
45
48
|
questions = []
|
|
@@ -73,7 +76,7 @@ module AtomicAssessmentsImport
|
|
|
73
76
|
end
|
|
74
77
|
|
|
75
78
|
{
|
|
76
|
-
activities: [],
|
|
79
|
+
activities: items.any? ? [build_activity(activity_title, items)] : [],
|
|
77
80
|
items: items,
|
|
78
81
|
questions: questions,
|
|
79
82
|
features: [],
|
|
@@ -83,6 +86,30 @@ module AtomicAssessmentsImport
|
|
|
83
86
|
|
|
84
87
|
private
|
|
85
88
|
|
|
89
|
+
def fallback_title
|
|
90
|
+
path = @file.is_a?(String) ? @file : @file.path
|
|
91
|
+
File.basename(path, ".*")
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# NOTE(#2237): one activity per source file. The issue also asks that a single
|
|
95
|
+
# file containing MULTIPLE exams split into one activity each — deferred until a
|
|
96
|
+
# real classic-format sample shows what an exam boundary looks like (we have no
|
|
97
|
+
# sample defining one). Revisit when such a file exists.
|
|
98
|
+
def build_activity(title, items)
|
|
99
|
+
{
|
|
100
|
+
reference: SecureRandom.uuid,
|
|
101
|
+
title: title,
|
|
102
|
+
description: "",
|
|
103
|
+
data: {
|
|
104
|
+
config: { title: title },
|
|
105
|
+
rendering_type: "assess",
|
|
106
|
+
items: items.map { |item| { reference: item[:reference], id: item[:reference] } },
|
|
107
|
+
},
|
|
108
|
+
status: "published",
|
|
109
|
+
tags: {},
|
|
110
|
+
}
|
|
111
|
+
end
|
|
112
|
+
|
|
86
113
|
def build_warning(message, index: nil, question_type: nil)
|
|
87
114
|
{
|
|
88
115
|
error_type: "warning",
|
|
@@ -164,7 +191,7 @@ module AtomicAssessmentsImport
|
|
|
164
191
|
# ExamSoft has a dedicated Multiple Answer question type, but Learnosity does not, so we need to update the question type and UI style for those questions
|
|
165
192
|
question_learnosity = question.to_learnosity
|
|
166
193
|
if row["question type"] == "ma"
|
|
167
|
-
question_learnosity[:data][:ui_style] = {
|
|
194
|
+
question_learnosity[:data][:ui_style] = { type: "horizontal" }
|
|
168
195
|
question_learnosity[:data][:multiple_responses] = true
|
|
169
196
|
end
|
|
170
197
|
|