Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions executor/costcomment.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,13 @@ func findCostComment(comments []models.IssueComment) *models.IssueComment {
}

// countFeedbackRounds returns the number of distinct feedback rounds
// in the existing entries. A round starts with a "Feedback (N)" entry;
// retries and error entries are excluded from the count.
// in the existing entries. A round starts with a non-retry "Feedback"
// entry (first attempt of each round, regardless of outcome).
func countFeedbackRounds(entries []costEntry) int {
count := 0
for _, e := range entries {
if strings.HasPrefix(e.Label, "Feedback") &&
!strings.Contains(e.Label, "retry") &&
!strings.Contains(e.Label, "error") {
!strings.Contains(e.Label, "retry") {
count++
}
}
Expand Down
8 changes: 4 additions & 4 deletions executor/costcomment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ func TestCountFeedbackRounds(t *testing.T) {
want: 0,
},
{
name: "error entries do not count as rounds",
name: "error entries count as rounds",
entries: []costEntry{
{Label: "Feedback (1)", Cost: 1},
{Label: "Feedback (error)", Cost: 1},
{Label: "Feedback (2)", Cost: 1},
{Label: "Feedback (2) (error)", Cost: 1},
{Label: "Feedback (3)", Cost: 1},
},
want: 2,
want: 3,
},
}

Expand Down
Loading