mirror of
https://github.com/Threnklyn/zeit.git
synced 2026-05-19 05:13:31 +02:00
entry.GetDuration() fix for negative duration total with ongoing task; ref #11
This commit is contained in:
@@ -131,6 +131,9 @@ func (entry *Entry) GetOutputForTrack(isRunning bool, wasRunning bool) (string)
|
|||||||
|
|
||||||
func (entry *Entry) GetDuration() (decimal.Decimal) {
|
func (entry *Entry) GetDuration() (decimal.Decimal) {
|
||||||
duration := entry.Finish.Sub(entry.Begin)
|
duration := entry.Finish.Sub(entry.Begin)
|
||||||
|
if (duration < 0) {
|
||||||
|
duration = time.Now().Sub(entry.Begin)
|
||||||
|
}
|
||||||
return decimal.NewFromFloat(duration.Hours())
|
return decimal.NewFromFloat(duration.Hours())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user