Skip to content

Commit 3863c9f

Browse files
committed
Show assignee name
1 parent 72923f9 commit 3863c9f

File tree

2 files changed

+9
-42
lines changed

2 files changed

+9
-42
lines changed

tools/flakeguard/cmd/create_jira_tickets.go

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"encoding/json"
77
"fmt"
88
"os"
9-
"path/filepath"
109
"regexp"
1110
"strconv"
1211
"strings"
@@ -149,6 +148,7 @@ ticket in a text-based UI. Press 'y' to confirm creation, 'n' to skip,
149148
}
150149
if re.MatchString(tickets[i].TestPackage) {
151150
tickets[i].AssigneeId = mapping.Assignee
151+
tickets[i].AssigneeName = mapping.AssigneeName
152152
break // use first matching mapping
153153
}
154154
}
@@ -599,11 +599,15 @@ func (m tmodel) View() string {
599599
header = headerStyle.Render(fmt.Sprintf("Ticket #%d of %d (Invalid)", m.index+1, len(m.tickets)))
600600
}
601601

602-
// New: Assignee line above Summary
602+
// Assignee
603603
var assigneeLine string
604-
if t.AssigneeId != "" {
605-
assigneeLine = summaryStyle.Render("Assignee:") + "\n" + t.AssigneeId
604+
var assigneeDisplayValue string
605+
if t.AssigneeName != "" {
606+
assigneeDisplayValue = fmt.Sprintf("%s (%s)", t.AssigneeName, t.AssigneeId)
607+
} else {
608+
assigneeDisplayValue = t.AssigneeId
606609
}
610+
assigneeLine = summaryStyle.Render("Assignee:") + "\n" + bodyStyle.Render(assigneeDisplayValue)
607611

608612
sum := summaryStyle.Render("Summary:")
609613
sumBody := descBodyStyle.Render(t.Summary)
@@ -709,41 +713,3 @@ func readFlakyTestsCSV(path string) ([][]string, error) {
709713
r := csv.NewReader(f)
710714
return r.ReadAll()
711715
}
712-
713-
func writeRemainingTicketsCSV(newPath string, m tmodel) error {
714-
confirmedRows := make(map[int]bool)
715-
for _, t := range m.tickets {
716-
if t.Confirmed || t.ExistingJiraKey != "" {
717-
confirmedRows[t.RowIndex] = true
718-
}
719-
}
720-
var newRecords [][]string
721-
orig := m.originalRecords
722-
if len(orig) > 0 {
723-
newRecords = append(newRecords, orig[0])
724-
}
725-
for i := 1; i < len(orig); i++ {
726-
if !confirmedRows[i] {
727-
newRecords = append(newRecords, orig[i])
728-
}
729-
}
730-
f, err := os.Create(newPath)
731-
if err != nil {
732-
return err
733-
}
734-
defer f.Close()
735-
w := csv.NewWriter(f)
736-
if err := w.WriteAll(newRecords); err != nil {
737-
return err
738-
}
739-
w.Flush()
740-
return w.Error()
741-
}
742-
743-
func makeRemainingCSVPath(originalPath string) string {
744-
ext := filepath.Ext(originalPath)
745-
base := strings.TrimSuffix(filepath.Base(originalPath), ext)
746-
dir := filepath.Dir(originalPath)
747-
newName := base + ".remaining" + ext
748-
return filepath.Join(dir, newName)
749-
}

tools/flakeguard/model/ticket.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type FlakyTicket struct {
1515
ExistingJiraKey string
1616
ExistingTicketSource string // "localdb" or "jira"
1717
AssigneeId string
18+
AssigneeName string
1819
Priority string
1920
FlakeRate float64
2021
SkippedAt time.Time // timestamp when the ticket was marked as skipped

0 commit comments

Comments
 (0)