Skip to content

Commit

Permalink
Merge pull request #282 from pcockwell/fix/choose-direct-transition-m…
Browse files Browse the repository at this point in the history
…atch-if-available

Choose exact transition match if available
  • Loading branch information
coryb authored Oct 1, 2019
2 parents 9bb0ff3 + a70384b commit d3b3c03
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.ToLower(trans.Name) == name {
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 d3b3c03

Please sign in to comment.