Skip to content

Commit

Permalink
Use lexical sorting if both required
Browse files Browse the repository at this point in the history
  • Loading branch information
sourishkrout committed Nov 5, 2024
1 parent 89850b0 commit fcea599
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions internal/owl/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,6 @@ func (res SetVarItems) sort() {
if j.Spec == nil {
return 1
}
if i.Spec.Required {
return -1
}
if j.Spec.Required {
return 1
}
if i.Spec.Name != "Opaque" && j.Spec.Name != "Opaque" {
jUpdated := j.Var.Updated.Unix()
iUpdated := i.Var.Updated.Unix()
Expand All @@ -210,6 +204,15 @@ func (res SetVarItems) sort() {
}
return delta
}
if i.Spec.Required && j.Spec.Required {
return strings.Compare(i.Var.Key, j.Var.Key)
}
if i.Spec.Required {
return -1
}
if j.Spec.Required {
return 1
}
if i.Spec.Name != "Opaque" {
return -1
}
Expand Down

0 comments on commit fcea599

Please sign in to comment.