Skip to content

Commit

Permalink
add statuses flag to STA pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Kravchenkov committed Jul 24, 2020
1 parent d39d6ab commit 620bd48
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
3 changes: 2 additions & 1 deletion JiraAnalytics/STA/SpendTimeAnalytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import (

const jiraApiUrl = "https://jira.surfstudio.ru/rest/api/2/search"

func StartSpendTimeAnalytics(user JiraAnalytics.JiraUserModel, board string, epicLink, projectId, sprint string) (SpendTimeAnalyticsResult, error) {
func StartSpendTimeAnalytics(user JiraAnalytics.JiraUserModel, board string, epicLink, projectId, sprint string, statuses []string) (SpendTimeAnalyticsResult, error) {
loader := jsrv.NewJiraIssueLoader(jiraApiUrl, user.Username, user.Password)

request := Common.JiraSearchRequest{
Wrapped: jsrv.SearchRequest{
Board: board,
IncludedStatuses: statuses,
IncludedTypes: []string{jmod.IssueTypeTask, jmod.IssueTypeBug, jmod.IssueTypeServiceTask},
ProjectID: projectId,
EpicLink: epicLink,
Expand Down
17 changes: 16 additions & 1 deletion SpendTimeAnalyticsInitializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"github.com/LastSprint/TeamLeadToolBox/JiraAnalytics"
"github.com/LastSprint/TeamLeadToolBox/JiraAnalytics/STA"
"strings"
)

type STAFormatter interface {
Expand All @@ -22,7 +23,21 @@ func CreateSpendTimeAnalytics(user JiraAnalytics.JiraUserModel, formatter STAFor
return &errMsg, nil
}

data, err := STA.StartSpendTimeAnalytics(user, *wtlBoardIdArg, safeStr(wtlEpicLink), safeStr(wtlProjectIdArg), safeStr(wtlSprintArg))
statuses := ""

if staStatuses == nil {
statuses = "Done"
} else {
statuses = *staStatuses
}

data, err := STA.StartSpendTimeAnalytics(
user,
*wtlBoardIdArg,
safeStr(wtlEpicLink),
safeStr(wtlProjectIdArg),
safeStr(wtlSprintArg),
strings.Split(statuses, ","))

return formatter.Handle(data, err)
}
Binary file modified TeamLeadToolBox
Binary file not shown.
1 change: 1 addition & 0 deletions docs/features/SpentTimeAnalytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ OptionalFlags:
- sprint - This is a project sprint. You can pass sprint name ("SPL iOS 01 Init") or id (123)
- epic - This is a project epic. You can pass just a name ("SPL-IOS Infrastructure") or id (SPL-1)
- mrkdown - If set then format output as markdown
- statuses - Tasks statuses you want to analyze. You can provide values separated by coma: `Done,\"In Progress\"`. If didn't specified `Done` would be used
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ var wtlBoardIdArg *string
var wtlSprintArg *string
var wtlPrintIssuesRefs *bool
var wtlEpicLink *string

var staStatuses *string

var mrkdown *bool

func main() {
Expand All @@ -37,7 +40,7 @@ func main() {
wtlEpicLink = wtlArgsSet.String("epic", "", "Jira Project's epic ID or name")
wtlPrintIssuesRefs = wtlArgsSet.Bool("showIssuesRefs", false, "Print all issues references under the each assignee name")
mrkdown = wtlArgsSet.Bool("mrkdown", false, "If set then format output as markdown")

staStatuses = wtlArgsSet.String("statuses", "Done", "Tasks statuses you want to analyze. You can provide values separated by coma: `Done,\"In Progress\"`. If didn't specified `Done` would be used")
config := map[string]string{}

err = json.Unmarshal(res, &config)
Expand Down

0 comments on commit 620bd48

Please sign in to comment.