From 6ea2ea7df78f5ca28c7267c35de36bf45a75b567 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Wed, 11 Oct 2023 15:41:02 +0200 Subject: [PATCH] Use helper functions GetTimeStep() and GetPriceForTimeStep() inside of GetCostFromDuration(). --- library/src/calculator_functions.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp index 57e518f..7e8e3f3 100644 --- a/library/src/calculator_functions.cpp +++ b/library/src/calculator_functions.cpp @@ -341,6 +341,15 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg, /// double Calculator::GetCostFromDuration(Configuration* cfg, uint8_t payment_option, const QDateTime start_datetime, QDateTime & end_datetime, double durationMin, bool nextDay, bool prepaid) { + if (cfg->project.project == "Schoenau" || cfg->project.project == "schoenau") { + static QList const timeSteps = GetTimeSteps(cfg, payment_option); + if (!timeSteps.contains(durationMin)) { + return 0.0f; // error: timestep not valid + } + + return GetPriceForTimeStep(cfg, payment_option, durationMin); + } + // Get input date QDateTime inputDate = start_datetime;