From c5b0ba134cee43e4e85d22f359896da918313869 Mon Sep 17 00:00:00 2001 From: Taras Petruk Date: Wed, 21 Apr 2021 14:13:52 +0300 Subject: [PATCH] set duration as negative starttime when receiving an update for a running time entry --- src/model/time_entry.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/model/time_entry.cc b/src/model/time_entry.cc index 996835f308..98f8d48667 100644 --- a/src/model/time_entry.cc +++ b/src/model/time_entry.cc @@ -490,9 +490,12 @@ void TimeEntry::LoadFromJSON(const Json::Value &data, bool syncServer) { if (!updateMergeableProperty("tid", TID)) SetTID(0, false); updateMergeableProperty("billable", Billable); - updateMergeableProperty("duration", DurationInSeconds); updateMergeablePropertyConvert("start", StartTime, convertTimeString); updateMergeablePropertyConvert("stop", StopTime, convertTimeString); + if (StopTime() == 0) + SetDurationInSeconds(-StartTime(), false); + else + updateMergeableProperty("duration", DurationInSeconds); // These properties are not sync-server-mergeable SetDurOnly(data["duronly"].asBool());