alembic 0.6.0 → 0.7.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/flows_controller.rb +1 -1
- data/app/controllers/concerns/alembic/summarizes.rb +1 -0
- data/app/models/alembic/flow/summaries.rb +22 -0
- data/db/migrate/20261020120000_add_kept_result_to_alembic_flow_run_summaries.rb +6 -0
- data/lib/alembic/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e81efddf247765d5a20f6134dc45c4f3d66199cf3e66c9247266614b7bce598a
|
|
4
|
+
data.tar.gz: 60fb3ffd6451a586ef2e575006821e3fc92fcdbeb15d4295958c449db38beebc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28126057cb83d2c6e1ac4b0054d8e1e31a822121ccdcec366c6deb2cdacd4c289ad281851a888c7ea713a7158786e1fbfb5fe4edb1544c9d74a288cbffdeb30b
|
|
7
|
+
data.tar.gz: '0397881ea22eccbe986ac55b927b934eef07be846de292894016b651a2289c0eda40018ec7e6ec76dc983673523c8bc260290a4fd20bea99c557d615905cd4d6'
|
|
@@ -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?
|
|
@@ -29,6 +29,7 @@ module Alembic
|
|
|
29
29
|
def finished(answers, finished_run)
|
|
30
30
|
@outputs = outputs_of(answers.transform_keys(&:to_s))
|
|
31
31
|
Flow::Summaries.new(flow).pin(finished_run) if finished_run && run.nil?
|
|
32
|
+
Flow::Summaries.new(finished_run.flow).keep(finished_run, answers.transform_keys(&:to_s)) if finished_run
|
|
32
33
|
@summary_page = Flow::Summaries.new(run&.flow || flow).summary_page
|
|
33
34
|
render template: @summary_page&.live_version ? "alembic/flows/summary_page" : "alembic/flows/complete"
|
|
34
35
|
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
|
data/lib/alembic/version.rb
CHANGED
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.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- tylercschneider
|
|
@@ -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
|