diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp index de03763..d655639 100644 --- a/library/src/calculator_functions.cpp +++ b/library/src/calculator_functions.cpp @@ -519,11 +519,28 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg, uint32_t const durationUnit = cfg->Duration.find(durationId)->second.pun_duration; new_price += pra_price; - //qCritical() << "(" << __func__ << ":" << __LINE__ << ") XXXXXX price:" << price; - //qCritical() << "(" << __func__ << ":" << __LINE__ << ") YYYYYY new_price:" << new_price; + +#if DEBUG_GET_DURATION_FROM_COST==1 + qCritical() << "(" << __func__ << ":" << __LINE__ << ") pra_price:" << pra_price; + qCritical() << "(" << __func__ << ":" << __LINE__ << ") price:" << price; + qCritical() << "(" << __func__ << ":" << __LINE__ << ") cost:" << cost; + qCritical() << "(" << __func__ << ":" << __LINE__ << ") new_price:" << new_price; +#endif + if (new_price <= cost) { - duration_previous = durationUnit; - //qCritical() << "(" << __func__ << ":" << __LINE__ << ") ZZZZZZ duration_previous" << duration_previous; + if (pop_accumulate_durations) { + duration_previous += durationUnit; + } else { + duration_previous = durationUnit; + } + durationInSecs = duration_previous * 60; + +#if DEBUG_GET_DURATION_FROM_COST==1 + qCritical() << "(" << __func__ << ":" << __LINE__ << ") durationUnit" << durationUnit; + qCritical() << "(" << __func__ << ":" << __LINE__ << ") duration_previous" << duration_previous; + qCritical() << "(" << __func__ << ":" << __LINE__ << ") durationInSecs" << durationInSecs; +#endif + } else { found = true; //qCritical() << "(" << __func__ << ":" << __LINE__ << ") WWWWWW duration_previous" << duration_previous;