Skip to content

Commit 2c8dee7

Browse files
committed
get more details per report item
1 parent 0da6716 commit 2c8dee7

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

cmd/export.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ var exportCmd = &cobra.Command{
7272
}
7373
return report
7474
},
75+
"AllSelectedProjects": func() []string {
76+
return projects
77+
},
7578
"AllWorkTypes": func() []tmetric.Tag {
7679
workTypes, _ := tmetric.GetAllWorkTypes(config, tmetricUser)
7780
return workTypes

tmetric/report.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ import (
1313
)
1414

1515
type ReportItem struct {
16-
StartTime string `json:"startTime"`
17-
EndTime string `json:"endTime"`
18-
User string `json:"user"`
19-
IssueId string `json:"issueId"`
20-
WorkpackageId string
16+
StartTime string `json:"startTime"`
17+
EndTime string `json:"endTime"`
18+
User string `json:"user"`
19+
IssueId string `json:"issueId"`
20+
Project string `json:"project"`
21+
Client string `json:"client"`
22+
Description string `json:"description"`
23+
WorkpackageId string
24+
CalculatedDuration time.Duration
2125
}
2226

2327
type Report struct {
@@ -122,9 +126,9 @@ func GetDetailedReport(
122126
var report Report
123127
for _, item := range reportItems {
124128
item.WorkpackageId = strings.Trim(item.IssueId, "#") // remove leading '#' from issue id
129+
item.CalculatedDuration, _ = item.getDuration()
125130
report.ReportItems = append(report.ReportItems, item)
126-
itemDuration, _ := item.getDuration()
127-
report.Duration += itemDuration
131+
report.Duration += item.CalculatedDuration
128132
}
129133
return report, nil
130134
}

0 commit comments

Comments
 (0)