2020-02-29 01:20:46 +01:00
|
|
|
package model
|
|
|
|
|
2020-02-29 14:17:34 +01:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2020-03-04 23:07:26 +01:00
|
|
|
type Ticket struct {
|
2020-04-27 16:47:13 +01:00
|
|
|
GithubLink int `json:"github_link,omitempty"`
|
|
|
|
GithubStatus string `json:"github_status,omitempty"`
|
|
|
|
GithubAssignee string `json:"github_assignee,omitempty"`
|
|
|
|
JiraLink string `json:"jira_link,omitempty"`
|
|
|
|
JiraStatus string `json:"jira_status,omitempty"`
|
|
|
|
Summary string `json:"summary,omitempty"`
|
|
|
|
Description string `json:"description,omitempty"`
|
|
|
|
Data map[string]interface{} `json:"data,omitempty"`
|
2020-03-04 23:07:26 +01:00
|
|
|
}
|
2020-02-29 14:17:34 +01:00
|
|
|
|
2020-04-27 11:22:15 +01:00
|
|
|
func (t *Ticket) IsPublishedJira() bool {
|
|
|
|
return t.JiraLink != ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *Ticket) IsPublishedGithub() bool {
|
2020-09-24 12:41:48 +01:00
|
|
|
return t.IsPublishedJira() && t.GithubLink != 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *Ticket) IsAssigned() bool {
|
2020-09-24 13:02:04 +01:00
|
|
|
return t.IsPublishedGithub() && t.GithubAssignee != ""
|
2020-09-24 12:41:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *Ticket) IsClosed() bool {
|
2020-09-24 13:02:04 +01:00
|
|
|
return t.IsAssigned() && t.GithubStatus == "closed"
|
2020-04-27 11:22:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *Ticket) PrintStatus() {
|
2020-04-27 10:42:29 +01:00
|
|
|
if t.Summary != "" {
|
2020-04-27 11:22:15 +01:00
|
|
|
fmt.Printf("[%s] %s\n", t.JiraLink, t.Summary)
|
2020-04-27 10:42:29 +01:00
|
|
|
}
|
2020-03-06 19:54:52 +01:00
|
|
|
}
|