2020-09-24 14:02:04 +02:00
|
|
|
package model
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"text/tabwriter"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (c *Campaign) PrintUserReport() {
|
|
|
|
userTickets := map[string]int{}
|
|
|
|
for _, ticket := range c.Tickets {
|
2020-09-24 18:34:15 +02:00
|
|
|
if !ticket.IsClosed() {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2020-09-24 14:02:04 +02:00
|
|
|
user := ticket.GithubAssignee
|
|
|
|
if user != "" {
|
|
|
|
if count, ok := userTickets[user]; ok {
|
2020-09-24 19:01:18 +02:00
|
|
|
userTickets[user] = count + 1
|
2020-09-24 14:02:04 +02:00
|
|
|
} else {
|
|
|
|
userTickets[user] = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-24 14:17:27 +02:00
|
|
|
fmt.Println()
|
2020-09-24 14:16:51 +02:00
|
|
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', tabwriter.AlignRight)
|
2020-09-24 14:02:04 +02:00
|
|
|
fmt.Fprintln(w, "GitHub username\tTickets closed\t")
|
2020-09-24 14:16:51 +02:00
|
|
|
fmt.Fprintln(w, "---------------\t--------------\t")
|
2020-09-24 14:02:04 +02:00
|
|
|
for user, count := range userTickets {
|
|
|
|
fmt.Fprintf(w, "%s\t%d\t\n", user, count)
|
|
|
|
}
|
|
|
|
w.Flush()
|
|
|
|
fmt.Println()
|
|
|
|
}
|