Merge branch 'kleipeda-experimental' of /home/siegert/atbfs01entwicklung/Elektronik/PTU/git_bare_repos/libmobilisis-calc into kleipeda-experimental
This commit is contained in:
commit
1ea03f522c
@ -2722,7 +2722,11 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
|
|||||||
uint32_t Calculator::GetDurationForPrice(Configuration *cfg, int price) const {
|
uint32_t Calculator::GetDurationForPrice(Configuration *cfg, int price) const {
|
||||||
int const pop_id = cfg->getPaymentOptions().pop_id;
|
int const pop_id = cfg->getPaymentOptions().pop_id;
|
||||||
|
|
||||||
|
int const pop_accumulate_prices = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_prices;
|
||||||
|
|
||||||
|
uint32_t new_price = 0;
|
||||||
uint32_t duration = 0;
|
uint32_t duration = 0;
|
||||||
|
uint32_t duration_previous = 0;
|
||||||
|
|
||||||
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr)
|
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr)
|
||||||
{
|
{
|
||||||
@ -2738,6 +2742,15 @@ uint32_t Calculator::GetDurationForPrice(Configuration *cfg, int price) const {
|
|||||||
if (pra_price < price) {
|
if (pra_price < price) {
|
||||||
duration = durationUnit;
|
duration = durationUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pop_accumulate_prices) {
|
||||||
|
new_price += pra_price;
|
||||||
|
if (new_price <= price) {
|
||||||
|
duration_previous = durationUnit;
|
||||||
|
} else {
|
||||||
|
return duration_previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return duration;
|
return duration;
|
||||||
|
Loading…
Reference in New Issue
Block a user