Merge pull request #12 from bladedvox/main

Fix negative result for `list --total` with ongoing task
This commit is contained in:
マリウス 2021-06-14 05:18:14 +00:00 committed by GitHub
commit 2465fec28b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,6 +131,9 @@ func (entry *Entry) GetOutputForTrack(isRunning bool, wasRunning bool) (string)
func (entry *Entry) GetDuration() (decimal.Decimal) {
duration := entry.Finish.Sub(entry.Begin)
if (duration < 0) {
duration = time.Now().Sub(entry.Begin)
}
return decimal.NewFromFloat(duration.Hours())
}