From 696ce644abf4aa21e20a5b5849411e607a06f2c2 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Mon, 19 Feb 2024 12:00:45 +0100 Subject: [PATCH] GetCostFromDuration(): take into account that (for Kirchdorf and progressive tariff) there is no carry over. --- library/src/calculator_functions.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp index 97dec43..efee9fa 100644 --- a/library/src/calculator_functions.cpp +++ b/library/src/calculator_functions.cpp @@ -525,14 +525,17 @@ double Calculator::GetCostFromDuration(Configuration* cfg, } } - if (current.time() >= to) { - QDateTime const dt = start; - start = start.addDays(1); - start.setTime(QTime(0, 0, 0)); + if (carryOverNotSet) { + return 0; + } else { + QDateTime const dt = start; + start = start.addDays(1); + start.setTime(QTime(0, 0, 0)); - durationMinutesBrutto += dt.secsTo(start) / 60; - current = start; + durationMinutesBrutto += dt.secsTo(start) / 60; + current = start; + } } else { break; }