From 1a350c0aeb34898e5821ca2173331acb53db5742 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 22 Feb 2024 09:31:41 +0100 Subject: [PATCH] GetDurationFromCost(): aded section if prepaid is not set. E.g. for Linsinger Maschinenbau (Neuhauser, 741): here, the buying of food stamps is obviously only possible at certain times. --- library/src/calculator_functions.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp index 8d8a712..551d737 100644 --- a/library/src/calculator_functions.cpp +++ b/library/src/calculator_functions.cpp @@ -496,9 +496,22 @@ double Calculator::GetCostFromDuration(Configuration* cfg, end_datetime.setTime(cs.getAllowedTimeRange().getTimeUntil()); return cost; } + } else { + // it might be that in such a case even prepaid ("vorkauf") + // is not allowed at any moment + // added e.g. for neuhauser-linsinger maschinenbau (741): + // the buying of food stamps ("essensmarken") is not allowed + // at any moment + CalcState cs = isParkingAllowed(cfg, start_datetime); + if (cs) { + end_datetime = start_datetime.addSecs(durationMinutes*60); + double cost = GetCostFromDuration(cfg, start_datetime, end_datetime); + end_datetime = start_datetime; + end_datetime.setTime(cs.getAllowedTimeRange().getTimeUntil()); + return cost; + } } - qCritical() << __PRETTY_FUNCTION__ << "NOT YET IMPLEMENTED"; end_datetime = QDateTime(); return 0; }