mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
feat: order workspaces by running first (#7656)
* wip * use updated sql * wip * Implement sorting in databasefake.go * More fixes * sql fmt --------- Co-authored-by: Marcin Tojek <marcin@coder.com>
This commit is contained in:
@@ -77,7 +77,11 @@ WHERE
|
||||
SELECT
|
||||
workspaces.*, COUNT(*) OVER () as count
|
||||
FROM
|
||||
workspaces
|
||||
workspaces
|
||||
JOIN
|
||||
users
|
||||
ON
|
||||
workspaces.owner_id = users.id
|
||||
LEFT JOIN LATERAL (
|
||||
SELECT
|
||||
workspace_builds.transition,
|
||||
@@ -238,7 +242,12 @@ WHERE
|
||||
-- Authorize Filter clause will be injected below in GetAuthorizedWorkspaces
|
||||
-- @authorize_filter
|
||||
ORDER BY
|
||||
last_used_at DESC
|
||||
(latest_build.completed_at IS NOT NULL AND
|
||||
latest_build.canceled_at IS NULL AND
|
||||
latest_build.error IS NULL AND
|
||||
latest_build.transition = 'start'::workspace_transition) DESC,
|
||||
LOWER(users.username) ASC,
|
||||
LOWER(name) ASC
|
||||
LIMIT
|
||||
CASE
|
||||
WHEN @limit_ :: integer > 0 THEN
|
||||
|
||||
Reference in New Issue
Block a user