Skip to content

fix: always return number of workspaces #12380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
SQL
  • Loading branch information
mtojek committed Mar 1, 2024
commit e018e46706acc96a02b708da28d2ae241a5ceac3
5 changes: 5 additions & 0 deletions coderd/database/dbmem/dbmem.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@ func (q *FakeQuerier) convertToWorkspaceRowsNoLock(ctx context.Context, workspac

rows = append(rows, wr)
}

// Append a technical row with summary
rows = append(rows, database.GetWorkspacesRow{
Count: count,
})
return rows
}

Expand Down
6 changes: 3 additions & 3 deletions coderd/database/modelqueries.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@ func (q *sqlQuerier) GetAuthorizedWorkspaces(ctx context.Context, arg GetWorkspa
// The name comment is for metric tracking
query := fmt.Sprintf("-- name: GetAuthorizedWorkspaces :many\n%s", filtered)
rows, err := q.db.QueryContext(ctx, query,
arg.RequesterID,
arg.Offset,
arg.Limit,
arg.Deleted,
arg.Status,
arg.OwnerID,
Expand All @@ -231,6 +228,9 @@ func (q *sqlQuerier) GetAuthorizedWorkspaces(ctx context.Context, arg GetWorkspa
arg.LastUsedBefore,
arg.LastUsedAfter,
arg.UsingActive,
arg.RequesterID,
arg.Offset,
arg.Limit,
)
if err != nil {
return nil, err
Expand Down
Loading