Private GetCostFromDuration() and GetCostFromDuration() helpers:
Use pyament method id (=4) as condition for if(...). The other condition (tariffIs24_7()) is used in calling functions.
This commit is contained in:
parent
60002404da
commit
67b12f4b33
@ -182,9 +182,8 @@ uint32_t Calculator::GetCostFromDuration(Configuration *cfg,
|
|||||||
quint64 timeStepInMinutes) const {
|
quint64 timeStepInMinutes) 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.
|
||||||
if (cfg->YearPeriod.size() == 0
|
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
||||||
&& cfg->SpecialDays.size() == 0
|
if (paymentMethodId == PaymentMethod::Steps) {
|
||||||
&& cfg->SpecialDaysWorktime.size() == 0) {
|
|
||||||
QDateTime const end = start.addSecs(timeStepInMinutes*60);
|
QDateTime const end = start.addSecs(timeStepInMinutes*60);
|
||||||
return GetCostFromDuration(cfg, start, end);
|
return GetCostFromDuration(cfg, start, end);
|
||||||
}
|
}
|
||||||
@ -194,9 +193,8 @@ uint32_t Calculator::GetCostFromDuration(Configuration *cfg,
|
|||||||
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) const {
|
||||||
if (cfg->YearPeriod.size() == 0
|
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
|
||||||
&& cfg->SpecialDays.size() == 0
|
if (paymentMethodId == PaymentMethod::Steps) {
|
||||||
&& cfg->SpecialDaysWorktime.size() == 0) {
|
|
||||||
int const timeStepInMinutes = start.secsTo(end) / 60;
|
int const timeStepInMinutes = start.secsTo(end) / 60;
|
||||||
return GetPriceForTimeStep(cfg, timeStepInMinutes);
|
return GetPriceForTimeStep(cfg, timeStepInMinutes);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user