Skip to content

Commit

Permalink
Fix Sorting (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
spjmurray authored Jul 30, 2024
1 parent 44e5440 commit efe2a38
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit efe2a38

Please sign in to comment.