From 0f742c4a506d44671ebd678bcc598bfc64510a06 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Sun, 13 Jun 2021 22:21:50 -0600 Subject: [PATCH] entry.GetDuration() fix for negative duration total with ongoing task; ref #11 --- z/entry.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/z/entry.go b/z/entry.go index 298f3d3..ce1c6ab 100644 --- a/z/entry.go +++ b/z/entry.go @@ -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()) }