Cleanup Requirement Order

This commit is contained in:
Tom Wiesing 2023-11-02 20:10:38 +01:00
parent d6c0c465e4
commit c43a584bc8
No known key found for this signature in database

View file

@ -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)