put targetversion 'git' to front

This commit is contained in:
Özgür Kesim 2024-02-05 10:51:12 +01:00
parent fc2ed32387
commit b9b128e92f
2 changed files with 26 additions and 3 deletions

11
data.go
View File

@ -267,7 +267,16 @@ func (d *Data) TargetVersions() (tv []string) {
for s := range m {
tv = append(tv, s)
}
sort.Strings(tv)
sort.Slice(tv,
func(i, j int) bool {
if strings.HasPrefix(tv[i], "git") {
return true
}
if strings.HasPrefix(tv[j], "git") {
return false
}
return strings.Compare(tv[i], tv[j]) < 0
})
return
}

View File

@ -125,6 +125,12 @@ type ByTarget []*Issue
func (b ByTarget) Len() int { return len(b) }
func (b ByTarget) Less(i, j int) bool {
if strings.HasPrefix(b[i].TargetVersion.Name, "git") {
return true
}
if strings.HasPrefix(b[j].TargetVersion.Name, "git") {
return false
}
return strings.Compare(b[i].TargetVersion.Name, b[j].TargetVersion.Name) < 0
}
func (b ByTarget) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
@ -268,7 +274,15 @@ var lessFuncs = map[string]lessFunc{
"Category": func(i1, i2 *Issue) bool { return strings.Compare(i1.Category.Name, i2.Category.Name) < 0 },
"Assignment": func(i1, i2 *Issue) bool { return strings.Compare(i1.Handler.Name, i2.Handler.Name) < 0 },
"Handler": func(i1, i2 *Issue) bool { return strings.Compare(i1.Handler.Name, i2.Handler.Name) < 0 },
"Target": func(i1, i2 *Issue) bool { return strings.Compare(i1.TargetVersion.Name, i2.TargetVersion.Name) < 0 },
"Target": func(i1, i2 *Issue) bool {
if strings.HasPrefix(i1.TargetVersion.Name, "git") {
return true
}
if strings.HasPrefix(i2.TargetVersion.Name, "git") {
return false
}
return strings.Compare(i1.TargetVersion.Name, i2.TargetVersion.Name) < 0
},
"Id": func(i1, i2 *Issue) bool { return i1.Id < i2.Id },
"Severity": func(i1, i2 *Issue) bool {
s1, ok := severityOrder[i1.Severity.Name]