From 48fccafe7615e34d01fe1e0360ae8c3db63377d5 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 6 Jun 2024 14:04:04 +0200 Subject: [PATCH] Fix: GetDurationFromCost() -> set inputDate if next valid working time-range in on another day and break the loop iterating through next days. --- library/src/calculator_functions.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp index e117855..9635eb1 100644 --- a/library/src/calculator_functions.cpp +++ b/library/src/calculator_functions.cpp @@ -320,12 +320,11 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg, } } - } - QDateTime upper = inputDate.addDays(days); - upper.setTime(next_working_time_from); + QDateTime upper = inputDate.addDays(days); + upper.setTime(next_working_time_from); - QDateTime lower = inputDate; - lower.setTime(current_working_time_to); + QDateTime lower = inputDate; + lower.setTime(current_working_time_to); inputDate = inputDate.addSecs(lower.secsTo(upper) + durationInSecs); #if DEBUG_GET_DURATION_FROM_COST==1