alembic 0.6.0 → 0.7.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 +4 -4
- data/app/controllers/alembic/flows_controller.rb +4 -0
- data/app/controllers/alembic/manage/flows_controller.rb +1 -1
- data/app/controllers/concerns/alembic/summarizes.rb +16 -1
- data/app/models/alembic/flow/summaries.rb +22 -0
- data/app/views/alembic/flows/complete.html.erb +1 -1
- data/app/views/alembic/flows/one_page.html.erb +2 -2
- data/app/views/alembic/flows/step.html.erb +1 -1
- data/db/migrate/20261020120000_add_kept_result_to_alembic_flow_run_summaries.rb +6 -0
- data/lib/alembic/version.rb +1 -1
- data/lib/alembic.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ebd0ef51eea97e6370103e3a49348ada05fcc41807ed10328e441297e93bb3b2
|
|
4
|
+
data.tar.gz: 26e892bfe991ca206d5ef15747b3d57a1434fd714e6748f9811d3fb3fb685586
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 651e4f43dac80bc3de140bbbbe92e728acb3ce0fc22423dc47ed7a89d7fb7cf8f0cf501f5ec96ec60fbb1926b3f73692a7e1b43a359afca8c3ff01beff9db6f6
|
|
7
|
+
data.tar.gz: 283bbbbc4909b992333b4cf71808338b6fd9849d1b01ec0945b89a893ca98c18ffc0c614fecb990b616cc45b01ac304ed42662551636b338351bed1f3cd851ec
|
|
@@ -21,7 +21,7 @@ module Alembic
|
|
|
21
21
|
|
|
22
22
|
def update
|
|
23
23
|
details = params.require(:flow)
|
|
24
|
-
summaries = Flow::Summaries.new(
|
|
24
|
+
summaries = Flow::Summaries.new(hosted_flows.find_by_public_code!(params[:id]))
|
|
25
25
|
summaries.describe(details[:summary]) unless details[:summary].nil?
|
|
26
26
|
summaries.start_on(owned_pages.find_by(id: details[:intro_page_id])) unless details[:intro_page_id].nil?
|
|
27
27
|
summaries.finish_on(owned_pages.find_by(id: details[:summary_page_id])) unless details[:summary_page_id].nil?
|
|
@@ -9,7 +9,7 @@ module Alembic
|
|
|
9
9
|
helper ResultBlocksHelper
|
|
10
10
|
helper ContentBlocksHelper
|
|
11
11
|
helper KsBlocks::LayoutHelper
|
|
12
|
-
helper_method :flow_summary, :first_step_path, :summary_values, :intro_values
|
|
12
|
+
helper_method :flow_summary, :first_step_path, :summary_values, :intro_values, :start_over_path, :visited_flow_address
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
private
|
|
@@ -22,6 +22,20 @@ module Alembic
|
|
|
22
22
|
flow_step_path(slug)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def start_over_path
|
|
26
|
+
flow_start_path(visited_flow_address)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def visited_flow_address
|
|
30
|
+
flow_address((run&.flow || flow).slug)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def step_form
|
|
34
|
+
return super if run
|
|
35
|
+
|
|
36
|
+
{ url: flow_step_path(visited_flow_address), method: :get }
|
|
37
|
+
end
|
|
38
|
+
|
|
25
39
|
def start_run(flow)
|
|
26
40
|
super.tap { |run| Flow::Summaries.new(flow).pin(run) }
|
|
27
41
|
end
|
|
@@ -29,6 +43,7 @@ module Alembic
|
|
|
29
43
|
def finished(answers, finished_run)
|
|
30
44
|
@outputs = outputs_of(answers.transform_keys(&:to_s))
|
|
31
45
|
Flow::Summaries.new(flow).pin(finished_run) if finished_run && run.nil?
|
|
46
|
+
Flow::Summaries.new(finished_run.flow).keep(finished_run, answers.transform_keys(&:to_s)) if finished_run
|
|
32
47
|
@summary_page = Flow::Summaries.new(run&.flow || flow).summary_page
|
|
33
48
|
render template: @summary_page&.live_version ? "alembic/flows/summary_page" : "alembic/flows/complete"
|
|
34
49
|
end
|
|
@@ -81,6 +81,17 @@ module Alembic
|
|
|
81
81
|
RunSummary.find_by(run: run)&.summary_version
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
+
def keep(run, state)
|
|
85
|
+
pinned = RunSummary.find_by(run: run)
|
|
86
|
+
return if pinned.nil? || pinned.score || pinned.seconds_taken
|
|
87
|
+
|
|
88
|
+
pinned.update!(score: score_of(run, state), seconds_taken: seconds_taken_by(run))
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def ranked
|
|
92
|
+
RunSummary.where(summary_version: versions).where.not(score: nil).order(score: :desc).order(RunSummary.arel_table[:seconds_taken].asc.nulls_last)
|
|
93
|
+
end
|
|
94
|
+
|
|
84
95
|
def of_run(run, state)
|
|
85
96
|
pinned = pinned_to(run)&.summary
|
|
86
97
|
return [] if pinned.blank?
|
|
@@ -90,6 +101,17 @@ module Alembic
|
|
|
90
101
|
|
|
91
102
|
private
|
|
92
103
|
|
|
104
|
+
def score_of(run, state)
|
|
105
|
+
of_run(run, state).find { |result| result.type == "weighted_sum" }&.value
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def seconds_taken_by(run)
|
|
109
|
+
return unless run.flow.each_step?
|
|
110
|
+
|
|
111
|
+
last_answered = run.completed_at.values.max
|
|
112
|
+
(last_answered - run.created_at).to_i if last_answered
|
|
113
|
+
end
|
|
114
|
+
|
|
93
115
|
def versions
|
|
94
116
|
SummaryVersion.where(flow: @flow)
|
|
95
117
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% content_for(:title, "Complete") %>
|
|
2
2
|
|
|
3
|
-
<% starting_over =
|
|
3
|
+
<% starting_over = start_over_path %>
|
|
4
4
|
|
|
5
5
|
<%= ui_page(max_width: :md) do %>
|
|
6
6
|
<%= ui_page_header(title: "That's everything", subtitle: "Thanks — here's what you told us") do |header| %>
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
<section class="py-20 md:py-28">
|
|
7
7
|
<div class="max-w-2xl mx-auto px-6">
|
|
8
|
-
<%= link_to "← Start over",
|
|
8
|
+
<%= link_to "← Start over", start_over_path, class: "text-sm text-accent-600 hover:text-accent-700" %>
|
|
9
9
|
|
|
10
|
-
<%= form_with url: flow_step_path(
|
|
10
|
+
<%= form_with url: flow_step_path(visited_flow_address), method: :get, data: { turbo: false, one_page: true }, class: "mt-6" do %>
|
|
11
11
|
<% @questions.each_with_index do |question, index| %>
|
|
12
12
|
<div data-one-page-question>
|
|
13
13
|
<div class="flex items-center justify-between text-sm text-gray-500 mb-2">
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<section class="py-20 md:py-28">
|
|
4
4
|
<div class="max-w-2xl mx-auto px-6">
|
|
5
|
-
<%= link_to "← Start over",
|
|
5
|
+
<%= link_to "← Start over", start_over_path, class: "text-sm text-accent-600 hover:text-accent-700" %>
|
|
6
6
|
|
|
7
7
|
<% answered = @answers.size %>
|
|
8
8
|
<% questions = answered + @guide.questions_left(@answers) %>
|
data/lib/alembic/version.rb
CHANGED
data/lib/alembic.rb
CHANGED
|
@@ -13,7 +13,7 @@ module Alembic
|
|
|
13
13
|
visitor_authorization_method refusal_method owner_method].freeze
|
|
14
14
|
|
|
15
15
|
class << self
|
|
16
|
-
attr_accessor :lead_address, :lead_fields_partial, :lead_note
|
|
16
|
+
attr_accessor :lead_address, :lead_fields_partial, :lead_note, :start_over_address
|
|
17
17
|
attr_reader :admin_authentication_method, :visitor_authorization_method, :refusal_method, :owner_method
|
|
18
18
|
|
|
19
19
|
FLOW_HOST_SETTINGS.each do |name|
|
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.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- tylercschneider
|
|
@@ -57,14 +57,14 @@ dependencies:
|
|
|
57
57
|
requirements:
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '0.
|
|
60
|
+
version: '0.25'
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '0.
|
|
67
|
+
version: '0.25'
|
|
68
68
|
description: Alembic builds and runs data-driven interactive diagnostics — scored
|
|
69
69
|
assessments and branching guides — that place a visitor on an outcome and capture
|
|
70
70
|
the result. A runtime engine plus a UI builder.
|
|
@@ -211,6 +211,7 @@ files:
|
|
|
211
211
|
- db/migrate/20260930233000_add_asks_on_one_page_to_alembic_flow_definition_summaries.rb
|
|
212
212
|
- db/migrate/20261001120002_add_intro_page_to_alembic_flow_definition_summaries.rb
|
|
213
213
|
- db/migrate/20261001170001_add_owner_to_alembic_pages.rb
|
|
214
|
+
- db/migrate/20261020120000_add_kept_result_to_alembic_flow_run_summaries.rb
|
|
214
215
|
- lib/alembic.rb
|
|
215
216
|
- lib/alembic/engine.rb
|
|
216
217
|
- lib/alembic/leftover_stylesheet.rb
|