Skip to content

Commit 6582a48

Browse files
committed
sort
1 parent cb7ca0e commit 6582a48

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

coderd/database/dbmem/dbmem.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5963,6 +5963,10 @@ func (q *FakeQuerier) GetWorkspaceBuildStatsByTemplates(ctx context.Context, sin
59635963
for _, ts := range templateStats {
59645964
rows = append(rows, ts)
59655965
}
5966+
5967+
sort.Slice(rows, func(i, j int) bool {
5968+
return rows[i].TemplateName < rows[j].TemplateName
5969+
})
59665970
return rows, nil
59675971
}
59685972

coderd/database/queries/workspacebuilds.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ WHERE
204204
AND pj.completed_at IS NOT NULL
205205
GROUP BY
206206
w.template_id, template_name, template_display_name, template_organization_id;
207+
ORDER BY
208+
template_name ASC;
207209

208210
-- name: GetFailedWorkspaceBuildsByTemplateID :many
209211
SELECT

coderd/notifications/reports/generator.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,6 @@ func reportFailedWorkspaceBuilds(ctx context.Context, logger slog.Logger, db dat
110110
if err != nil {
111111
return xerrors.Errorf("unable to fetch failed workspace builds: %w", err)
112112
}
113-
sort.Slice(statsRows, func(i, j int) bool {
114-
return statsRows[i].TemplateName < statsRows[j].TemplateName
115-
})
116113

117114
reportGeneratedNow := map[uuid.UUID]bool{}
118115
for _, stats := range statsRows {

0 commit comments

Comments
 (0)