atomic_assessments_import 0.4.0 → 0.5.1

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: d7c2b70c4beeb0f121cdcc5a6246b68806f7ffc19dca1081f4df4c2346b8f684
4
- data.tar.gz: 2fb3d3dda322a36af487277fd90875c3cc66a9eb29a442d31cb1297096925f01
3
+ metadata.gz: ea5ddcd5f7771a0f4deb7d55917db2e89753078d1cf7ae9b1ddef683c3a5c043
4
+ data.tar.gz: 851d6b514ea15db766552b6a69650a8d8253d921a91d2e3896f9c7de8a65e4f2
5
5
  SHA512:
6
- metadata.gz: 3aefad8373ea8d8d7f7e3eacbbc2df7f56a4bfa5060c6d0c78b936305eb7dc47e47f141bc631db2b81abcd227a07b9e62a90880c6253525500b9cfafa19f547f
7
- data.tar.gz: 707491e1f786a083fc26604d4c44ec6919d87214ae806848644b87760a4cd3271d795b4169c932bff30e7f165e3dcc58fcbdcb4e704602cfc31fe028ca068d48
6
+ metadata.gz: '0369038581025b520dbf9b423aafb3429ee864d221ace9a2f73d7e555925a63585fa531fff5c29bb30eefea1f5d952842e96ee47e6bb39dbd9471df869d4a595'
7
+ data.tar.gz: c2cc233ebb20322711e0266eaf1354d4692e16b4ce8ddbfe8c95c3e93b93c5b88e08521451505f9a1745a4c1872db2672ffc6f7b695cc173e1e503b1880c5b4c
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] = { choice_label: "upper-alpha", type: "block" }
194
+ question_learnosity[:data][:ui_style] = { type: "horizontal" }
168
195
  question_learnosity[:data][:multiple_responses] = true
169
196
  end
170
197
 
@@ -71,7 +71,6 @@ module AtomicAssessmentsImport
71
71
  "correct feedback" => nil,
72
72
  "incorrect feedback" => nil,
73
73
  "shuffle options" => nil,
74
- "template" => "block layout",
75
74
  }
76
75
 
77
76
  # Add option keys
@@ -4,7 +4,7 @@ module AtomicAssessmentsImport
4
4
  module Export
5
5
  def self.create(path, data)
6
6
  AtomicAssessmentsImport::Writer.new(path).open do |writer|
7
- writer.write("export.json", { version: 2.0 }.to_json)
7
+ writer.write("export.json", { version: "2.0" }.to_json)
8
8
 
9
9
  data[:activities].each do |activity|
10
10
  writer.write("activities/#{activity[:reference]}.json", activity.to_json)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AtomicAssessmentsImport
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atomic_assessments_import
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Collings
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.6.7
160
+ rubygems_version: 4.0.15
161
161
  specification_version: 4
162
162
  summary: Importer to Convert different formats to AA's import format
163
163
  test_files: []