GetCostFromDuration(): use new parameter paymentOptionIndex.
This commit is contained in:
parent
1852f552a3
commit
1ac2ca91c5
@ -4,6 +4,7 @@
|
|||||||
#include "tariff_log.h"
|
#include "tariff_log.h"
|
||||||
#include "tariff_time_range.h"
|
#include "tariff_time_range.h"
|
||||||
#include "ticket.h"
|
#include "ticket.h"
|
||||||
|
#include "tariff_global_defines.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -590,24 +591,26 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
|
|||||||
|
|
||||||
uint32_t Calculator::GetCostFromDuration(Configuration *cfg,
|
uint32_t Calculator::GetCostFromDuration(Configuration *cfg,
|
||||||
QDateTime const &start,
|
QDateTime const &start,
|
||||||
quint64 timeStepInMinutes) const {
|
quint64 timeStepInMinutes,
|
||||||
|
int paymentOptionIndex) const {
|
||||||
// for instance, a tariff as used in Schoenau, Koenigssee: only steps, no
|
// for instance, a tariff as used in Schoenau, Koenigssee: only steps, no
|
||||||
// special days, nonstop.
|
// special days, nonstop.
|
||||||
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
||||||
if (paymentMethodId == PaymentMethod::Steps) {
|
if (paymentMethodId == PaymentMethod::Steps) {
|
||||||
QDateTime const end = start.addSecs(timeStepInMinutes*60);
|
QDateTime const end = start.addSecs(timeStepInMinutes*60);
|
||||||
return GetCostFromDuration(cfg, start, end);
|
return GetCostFromDuration(cfg, start, end, paymentOptionIndex);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Calculator::GetCostFromDuration(Configuration * cfg,
|
uint32_t Calculator::GetCostFromDuration(Configuration * cfg,
|
||||||
QDateTime const &start,
|
QDateTime const &start,
|
||||||
QDateTime const &end) const {
|
QDateTime const &end,
|
||||||
|
int paymentOptionIndex) const {
|
||||||
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
||||||
if (paymentMethodId == PaymentMethod::Steps) {
|
if (paymentMethodId == PaymentMethod::Steps) {
|
||||||
int const timeStepInMinutes = start.secsTo(end) / 60;
|
int const timeStepInMinutes = start.secsTo(end) / 60;
|
||||||
return GetPriceForTimeStep(cfg, timeStepInMinutes);
|
return GetPriceForTimeStep(cfg, timeStepInMinutes, paymentOptionIndex);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user