Cleanup Requirement Order
This commit is contained in:
parent
d6c0c465e4
commit
c43a584bc8
1 changed files with 10 additions and 10 deletions
|
|
@ -33,21 +33,21 @@ func (requirements *Requirements) Get(ctx context.Context, server *phpx.Server)
|
|||
if err == nil {
|
||||
// sort first by weight, then by id!
|
||||
slices.SortFunc(data, func(a, b status.Requirement) int {
|
||||
// compare first by weight
|
||||
if a.Weight < b.Weight {
|
||||
return -1
|
||||
}
|
||||
if a.Weight > b.Weight {
|
||||
return 1
|
||||
}
|
||||
|
||||
// then by severity
|
||||
// compare first by severity
|
||||
if a.Severity < b.Severity {
|
||||
return -1
|
||||
return 1
|
||||
}
|
||||
if a.Severity > b.Severity {
|
||||
return -1
|
||||
}
|
||||
|
||||
// then by weight
|
||||
if a.Weight < b.Weight {
|
||||
return 1
|
||||
}
|
||||
if a.Weight > b.Weight {
|
||||
return -1
|
||||
}
|
||||
|
||||
// and finally by id
|
||||
return strings.Compare(a.ID, b.ID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue