Skip to content
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

Fix Sorting #42

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions charts/region/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: A Helm chart for deploying Unikorn's Region Controller

type: application

version: v0.1.27
appVersion: v0.1.27
version: v0.1.28
appVersion: v0.1.28

icon: https://raw.githubusercontent.com/unikorn-cloud/assets/main/images/logos/dark-on-light/icon.png

Expand Down
6 changes: 3 additions & 3 deletions pkg/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (h *Handler) GetApiV1OrganizationsOrganizationIDRegionsRegionIDFlavors(w ht

// Apply ordering guarantees, ascending order with GPUs taking precedence over
// CPUs and memory.
slices.SortFunc(result, func(a, b providers.Flavor) int {
slices.SortStableFunc(result, func(a, b providers.Flavor) int {
if v := cmp.Compare(a.GPUCount(), b.GPUCount()); v != 0 {
return v
}
Expand Down Expand Up @@ -246,7 +246,7 @@ func (h *Handler) GetApiV1OrganizationsOrganizationIDRegionsRegionIDImages(w htt
}

// Apply ordering guarantees, ordered by name.
slices.SortFunc(result, func(a, b providers.Image) int {
slices.SortStableFunc(result, func(a, b providers.Image) int {
return cmp.Compare(a.Name, b.Name)
})

Expand Down Expand Up @@ -344,7 +344,7 @@ func (h *Handler) GetApiV1OrganizationsOrganizationIDIdentities(w http.ResponseW
return
}

slices.SortFunc(result.Items, func(a, b unikornv1.Identity) int {
slices.SortStableFunc(result.Items, func(a, b unikornv1.Identity) int {
return cmp.Compare(a.Name, b.Name)
})

Expand Down
Loading