computeValueFirst returns the value for the first issue label that appears in PriorityLabels. It iterates issueLabels in their existing order and returns the value for the first one found in PriorityLabels; if none match, it falls back to the first value in matchingValues.
(issueLabels []string, matchingValues []int, matchedLabels []string)
| 86 | // It iterates issueLabels in their existing order and returns the value for the first one |
| 87 | // found in PriorityLabels; if none match, it falls back to the first value in matchingValues. |
| 88 | func (om *ObjectiveMapping) computeValueFirst(issueLabels []string, matchingValues []int, matchedLabels []string) int { |
| 89 | // Return first issue label that's in priority_labels |
| 90 | if len(om.PriorityLabels) > 0 { |
| 91 | for _, issueLabel := range issueLabels { |
| 92 | for _, priorityLabel := range om.PriorityLabels { |
| 93 | if strings.EqualFold(issueLabel, priorityLabel) { |
| 94 | normalizedIssue := strings.ToLower(strings.TrimSpace(issueLabel)) |
| 95 | if val, ok := om.LabelToValue[normalizedIssue]; ok { |
| 96 | labelObjectiveMappingLog.Printf("Computed objective value via issue label priority: label=%s, value=%d", issueLabel, val) |
| 97 | return val |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | // Fallback to first matching label |
| 104 | result := matchingValues[0] |
| 105 | labelObjectiveMappingLog.Printf("Computed objective value via first match: labels=%v, value=%d", matchedLabels, result) |
| 106 | return result |
| 107 | } |
| 108 | |
| 109 | // computeValueMax returns the highest value among all matching labels. |
| 110 | func (om *ObjectiveMapping) computeValueMax(matchingValues []int, matchedLabels []string) int { |
no test coverage detected