mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-18 20:23:28 +02:00
Choose exact transition match if available
This commit is contained in:
committed by
Cory Bennett
parent
2062dffc60
commit
62ccffaf05
@@ -9,10 +9,17 @@ import (
|
||||
// or nil
|
||||
func (t Transitions) Find(name string) *Transition {
|
||||
name = strings.ToLower(name)
|
||||
matches := []Transitions{}
|
||||
for _, trans := range t {
|
||||
if strings.Contains(strings.ToLower(trans.Name), name) {
|
||||
if strings.Compare(strings.ToLower(trans.Name), name) == 0 {
|
||||
return trans
|
||||
}
|
||||
if strings.Contains(strings.ToLower(trans.Name), name) {
|
||||
matches = append(matches, trans)
|
||||
}
|
||||
}
|
||||
if len(matches) > 0 {
|
||||
return matches[0]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user