mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
Support all transitions in build progress bar (#4575)
* Use null types instead of -1 for simplicity * Fix pgcrypto bug in migration 59 * Add stories * Fix visual stutter
This commit is contained in:
@ -109,7 +109,8 @@ RETURNING
|
||||
-- name: GetTemplateAverageBuildTime :one
|
||||
WITH build_times AS (
|
||||
SELECT
|
||||
EXTRACT(EPOCH FROM (pj.completed_at - pj.started_at))::FLOAT AS exec_time_sec
|
||||
EXTRACT(EPOCH FROM (pj.completed_at - pj.started_at))::FLOAT AS exec_time_sec,
|
||||
workspace_builds.transition
|
||||
FROM
|
||||
workspace_builds
|
||||
JOIN template_versions ON
|
||||
@ -118,7 +119,6 @@ JOIN provisioner_jobs pj ON
|
||||
workspace_builds.job_id = pj.id
|
||||
WHERE
|
||||
template_versions.template_id = @template_id AND
|
||||
(workspace_builds.transition = 'start') AND
|
||||
(pj.completed_at IS NOT NULL) AND (pj.started_at IS NOT NULL) AND
|
||||
(pj.started_at > @start_time) AND
|
||||
(pj.canceled_at IS NULL) AND
|
||||
@ -126,6 +126,11 @@ WHERE
|
||||
ORDER BY
|
||||
workspace_builds.created_at DESC
|
||||
)
|
||||
SELECT coalesce((PERCENTILE_DISC(0.5) WITHIN GROUP(ORDER BY exec_time_sec)), -1)::FLOAT
|
||||
SELECT
|
||||
-- Postgres offers no clear way to DRY this short of a function or other
|
||||
-- complexities.
|
||||
coalesce((PERCENTILE_DISC(0.5) WITHIN GROUP(ORDER BY exec_time_sec) FILTER (WHERE transition = 'start')), -1)::FLOAT AS start_median,
|
||||
coalesce((PERCENTILE_DISC(0.5) WITHIN GROUP(ORDER BY exec_time_sec) FILTER (WHERE transition = 'stop')), -1)::FLOAT AS stop_median,
|
||||
coalesce((PERCENTILE_DISC(0.5) WITHIN GROUP(ORDER BY exec_time_sec) FILTER (WHERE transition = 'delete')), -1)::FLOAT AS delete_median
|
||||
FROM build_times
|
||||
;
|
||||
|
Reference in New Issue
Block a user