Show if active in time
command
This commit is contained in:
parent
ba0e465723
commit
fd0b0cfb56
@ -131,16 +131,22 @@ func (a *AppState) opShowTime(args []string) int {
|
||||
}
|
||||
list = list.Filter(doFilters)
|
||||
|
||||
var isActive bool
|
||||
var total time.Duration
|
||||
for _, v := range *list {
|
||||
dur := v.FinishDate.Sub(v.StartDate)
|
||||
if v.FinishDate.IsZero() {
|
||||
dur = time.Now().Sub(v.StartDate)
|
||||
isActive = true
|
||||
}
|
||||
total += dur
|
||||
}
|
||||
total = total.Round(GetRoundToDuration())
|
||||
fmt.Printf("%.2f\n", DurationToDecimal(total))
|
||||
if isActive {
|
||||
fmt.Printf("%.2f+\n", DurationToDecimal(total))
|
||||
} else {
|
||||
fmt.Printf("%.2f\n", DurationToDecimal(total))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user