alembic 0.15.0 → 0.16.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 +4 -4
- data/app/controllers/alembic/manage/answer_keys_controller.rb +5 -0
- data/app/controllers/concerns/alembic/summarizes.rb +6 -1
- data/app/models/alembic/flow/answer_key.rb +4 -0
- data/app/views/alembic/flows/step.html.erb +2 -2
- data/lib/alembic/answer_explanations.rb +25 -0
- data/lib/alembic/engine.rb +4 -0
- data/lib/alembic/version.rb +1 -1
- data/lib/alembic.rb +14 -3
- metadata +4 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f4ad973a4cd7a81bb2d9ff18e31075ca5b4dc32c20b82c86d3cdbf39445ce28d
|
|
4
|
+
data.tar.gz: fdf0002e2cb0c7a559be457f24df5af9d64354f6136d5428a81e6a31c7b4e00b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d0f8baba0a3c8f8b0eef256bae0bf3211a8037216f4ebbf6df5ea09c830de4ed50b23f07f8cf1c754757aa09884216d9fb2402f5d27c871c242f2b88118c2ac5
|
|
7
|
+
data.tar.gz: 546561d85803831584fa1e8aa6b9ce9bcf6503c51277e6a0b36258cd71ceab78ae252acdd6b4c721b2affbf5e5be62eb59dd128480ea7bcfd7f6e417290667bc
|
|
@@ -21,6 +21,11 @@ module Alembic
|
|
|
21
21
|
Flow::AnswerKey.chosen(step_settings(question.id))
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
def named_right_answer(question)
|
|
25
|
+
accepted = Flow::AnswerKey.accepted(step_settings(question.id))
|
|
26
|
+
accepted.any? ? accepted.to_sentence(two_words_connector: " or ", last_word_connector: ", or ") : super
|
|
27
|
+
end
|
|
28
|
+
|
|
24
29
|
def shows_answer_values?
|
|
25
30
|
Flow::Summaries.new(previewed).shows_answer_values?
|
|
26
31
|
end
|
|
@@ -10,7 +10,7 @@ module Alembic
|
|
|
10
10
|
helper ContentBlocksHelper
|
|
11
11
|
helper KsBlocks::LayoutHelper
|
|
12
12
|
after_action :keep_ended_inner_run, only: :step
|
|
13
|
-
helper_method :flow_summary, :first_step_path, :summary_values, :intro_values, :start_over_path, :finish_link, :visited_flow_address, :answered_right?, :single_choice?, :drawing_of, :chosen_answer, :step_category, :shown
|
|
13
|
+
helper_method :flow_summary, :first_step_path, :summary_values, :intro_values, :start_over_path, :finish_link, :visited_flow_address, :answered_right?, :single_choice?, :drawing_of, :chosen_answer, :named_right_answer, :step_category, :shown
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
private
|
|
@@ -41,6 +41,11 @@ module Alembic
|
|
|
41
41
|
|
|
42
42
|
def chosen_answer(_question); end
|
|
43
43
|
|
|
44
|
+
def named_right_answer(question)
|
|
45
|
+
chosen = chosen_answer(question)
|
|
46
|
+
@guide.choice_label(question.id, chosen) if chosen.present?
|
|
47
|
+
end
|
|
48
|
+
|
|
44
49
|
def start_over_path
|
|
45
50
|
flow_start_path(visited_flow_address)
|
|
46
51
|
end
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
<%= render @drawing, step: shown(@question), chosen: chosen_answer(@question) %>
|
|
33
33
|
<% end %>
|
|
34
34
|
|
|
35
|
-
<% if (right_answer =
|
|
36
|
-
<%= ui_value_list(rows: [ { label: ui_badge(label: "Right answer", variant: :success), value:
|
|
35
|
+
<% if (right_answer = named_right_answer(@question)).present? %>
|
|
36
|
+
<%= ui_value_list(rows: [ { label: ui_badge(label: "Right answer", variant: :success), value: right_answer } ]) %>
|
|
37
37
|
<% end %>
|
|
38
38
|
|
|
39
39
|
<div class="mt-8 flex items-center gap-4">
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Alembic
|
|
2
|
+
module AnswerExplanations
|
|
3
|
+
TEXT = {
|
|
4
|
+
"question" => {
|
|
5
|
+
"answers.info" => "Extra detail saved with this answer, which the question page does not show to a player.",
|
|
6
|
+
"answers.hint" => "A smaller line a player sees under this answer's text.",
|
|
7
|
+
"answers.label" => "The text a player sees for this answer in place of its value.",
|
|
8
|
+
"answers.value" => "The text saved when a player picks this answer, which the player also sees when the label is blank or the flow shows answer values.",
|
|
9
|
+
"answers.weight" => "The points a player scores by picking this answer, and any weight above zero makes it a right answer."
|
|
10
|
+
},
|
|
11
|
+
"multiple_select" => {
|
|
12
|
+
"answers.label" => "The text a player sees for this answer in place of its value.",
|
|
13
|
+
"answers.value" => "The text saved when a player ticks this answer, which the player also sees when the label is blank.",
|
|
14
|
+
"answers.weight" => "Any weight above zero makes this a right answer, whatever its size, and the question scores one point only when a player ticks every right answer and no others."
|
|
15
|
+
},
|
|
16
|
+
"fill_in_the_blank" => {
|
|
17
|
+
"accepted_answers.value" => "A typed answer that matches this text, ignoring capitals and the spaces around it, is right and scores one point."
|
|
18
|
+
}
|
|
19
|
+
}.freeze
|
|
20
|
+
|
|
21
|
+
def explanation_for(step_type, setting)
|
|
22
|
+
super || TEXT.dig(step_type.to_s, setting.to_s)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
data/lib/alembic/engine.rb
CHANGED
|
@@ -33,6 +33,10 @@ module Alembic
|
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
initializer "alembic.answer_explanations" do |app|
|
|
37
|
+
app.config.to_prepare { Alembic.explain_answer_fields }
|
|
38
|
+
end
|
|
39
|
+
|
|
36
40
|
initializer "alembic.question_importer" do |app|
|
|
37
41
|
app.config.to_prepare { require "alembic/question_importer" if defined?(Ixport::Importer) }
|
|
38
42
|
end
|
data/lib/alembic/version.rb
CHANGED
data/lib/alembic.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
require "alembic/version"
|
|
3
3
|
require "alembic/engine"
|
|
4
|
+
require "alembic/answer_explanations"
|
|
4
5
|
|
|
5
6
|
module Alembic
|
|
6
7
|
NotPublished = EasyFlow::NotPublished
|
|
@@ -37,9 +38,12 @@ module Alembic
|
|
|
37
38
|
end
|
|
38
39
|
|
|
39
40
|
def set_up_flow_host
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
host = explain_answer_fields
|
|
42
|
+
FLOW_HOST_SETTINGS.each { |name| host.public_send(:"#{name}=", public_send(name)) }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def explain_answer_fields
|
|
46
|
+
flow_host.extend(AnswerExplanations)
|
|
43
47
|
end
|
|
44
48
|
|
|
45
49
|
def lead_partial=(_partial)
|
|
@@ -69,6 +73,13 @@ module Alembic
|
|
|
69
73
|
def admin_layout
|
|
70
74
|
@admin_layout || "application"
|
|
71
75
|
end
|
|
76
|
+
|
|
77
|
+
private
|
|
78
|
+
|
|
79
|
+
def flow_host
|
|
80
|
+
host = EasyFlow.host_named(FLOW_HOST)
|
|
81
|
+
host.set_up? ? host : EasyFlow.host(FLOW_HOST)
|
|
82
|
+
end
|
|
72
83
|
end
|
|
73
84
|
|
|
74
85
|
set_up_flow_host
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: alembic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.16.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- tylercschneider
|
|
@@ -57,20 +57,14 @@ dependencies:
|
|
|
57
57
|
requirements:
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '0.
|
|
61
|
-
- - ">="
|
|
62
|
-
- !ruby/object:Gem::Version
|
|
63
|
-
version: 0.32.1
|
|
60
|
+
version: '0.35'
|
|
64
61
|
type: :runtime
|
|
65
62
|
prerelease: false
|
|
66
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
67
64
|
requirements:
|
|
68
65
|
- - "~>"
|
|
69
66
|
- !ruby/object:Gem::Version
|
|
70
|
-
version: '0.
|
|
71
|
-
- - ">="
|
|
72
|
-
- !ruby/object:Gem::Version
|
|
73
|
-
version: 0.32.1
|
|
67
|
+
version: '0.35'
|
|
74
68
|
description: Alembic builds and runs data-driven interactive diagnostics — scored
|
|
75
69
|
assessments and branching guides — that place a visitor on an outcome and capture
|
|
76
70
|
the result. A runtime engine plus a UI builder.
|
|
@@ -228,6 +222,7 @@ files:
|
|
|
228
222
|
- db/migrate/20261020120000_add_kept_result_to_alembic_flow_run_summaries.rb
|
|
229
223
|
- db/migrate/20261025031225_add_shuffles_answers_to_alembic_flow_definition_summaries.rb
|
|
230
224
|
- lib/alembic.rb
|
|
225
|
+
- lib/alembic/answer_explanations.rb
|
|
231
226
|
- lib/alembic/engine.rb
|
|
232
227
|
- lib/alembic/leftover_stylesheet.rb
|
|
233
228
|
- lib/alembic/question_importer.rb
|