GetPriceForTimeStep():
Use "pop_accumulate_durations" setting to sum up the durations. Otherwise time-step will not be found in time-step-list.
This commit is contained in:
parent
36b3e85d1b
commit
1023f6ede1
@ -2810,11 +2810,13 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
|
|||||||
// paymentOptionIndex = 1;
|
// paymentOptionIndex = 1;
|
||||||
|
|
||||||
int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
|
int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
|
||||||
|
int const pop_accumulate_durations = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_durations;
|
||||||
int const pop_accumulate_prices = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_prices;
|
int const pop_accumulate_prices = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_prices;
|
||||||
|
|
||||||
uint32_t price = 0;
|
uint32_t price = 0;
|
||||||
|
int pun_duration = 0;
|
||||||
|
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") paymentOptionIndex" << paymentOptionIndex;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") paymentOptionIndex" << paymentOptionIndex;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_id" << pop_id;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pop_id" << pop_id;
|
||||||
|
|
||||||
@ -2828,19 +2830,25 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
|
|||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << pun_id;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << pun_id;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_unit_id" << payment_unit_id;
|
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_unit_id" << payment_unit_id;
|
||||||
|
|
||||||
int const pun_duration = cfg->Duration.find(payment_unit_id)->second.pun_duration;
|
if (pop_accumulate_durations) {
|
||||||
//int const pun_duration = cfg->Duration.find(2)->second.pun_duration;
|
pun_duration += cfg->Duration.find(payment_unit_id)->second.pun_duration;
|
||||||
|
} else {
|
||||||
|
pun_duration = cfg->Duration.find(payment_unit_id)->second.pun_duration;
|
||||||
|
}
|
||||||
|
|
||||||
if (pop_accumulate_prices) {
|
if (pop_accumulate_prices) {
|
||||||
price += itr->second.pra_price;
|
price += itr->second.pra_price;
|
||||||
} else {
|
} else {
|
||||||
price = (uint32_t)(itr->second.pra_price);
|
price = (uint32_t)(itr->second.pra_price);
|
||||||
}
|
}
|
||||||
|
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") price" << price;
|
if (DBG_LEVEL >= DBG_DEBUG) {
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << pun_id;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") price" << price;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_unit_id" << payment_unit_id;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_id" << pun_id;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_duration" << pun_duration;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_unit_id" << payment_unit_id;
|
||||||
//qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") pun_duration" << pun_duration;
|
||||||
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
|
||||||
|
}
|
||||||
|
|
||||||
if (timeStep == pun_duration) {
|
if (timeStep == pun_duration) {
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") return price" << price;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") return price" << price;
|
||||||
|
Loading…
Reference in New Issue
Block a user