Skip to content

Commit

Permalink
Choose exact transition match if available
Browse files Browse the repository at this point in the history
  • Loading branch information
pcockwell committed Sep 30, 2019
1 parent 9bb0ff3 commit a646f76
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion jiradata/TransitionsFuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit a646f76

Please sign in to comment.