GetCostFromDuration(): don't use condiftion PaymentMethod::Steps,
but the multimap YearPeriod, which must be empty.
This commit is contained in:
parent
574161ff76
commit
80e228b498
@ -350,30 +350,28 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
///
|
///
|
||||||
|
|
||||||
uint32_t Calculator::GetCostFromDuration(Configuration const* cfg,
|
uint32_t Calculator::GetCostFromDuration(Configuration *cfg,
|
||||||
QDateTime const &start,
|
QDateTime const &start,
|
||||||
quint64 timeStepInMinutes,
|
quint64 timeStepInMinutes) const {
|
||||||
uint8_t paymentMethod) {
|
|
||||||
// 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 (paymentMethod == PaymentMethod::Steps
|
if (cfg->YearPeriod.size() == 0
|
||||||
&& cfg->SpecialDays.size() == 0
|
&& cfg->SpecialDays.size() == 0
|
||||||
&& cfg->SpecialDaysWorktime.size() == 0) {
|
&& cfg->SpecialDaysWorktime.size() == 0) {
|
||||||
QDateTime const end = start.addSecs(timeStepInMinutes*60);
|
QDateTime const end = start.addSecs(timeStepInMinutes*60);
|
||||||
return GetCostFromDuration(cfg, start, end, paymentMethod);
|
return GetCostFromDuration(cfg, start, end);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Calculator::GetCostFromDuration(Configuration const* cfg,
|
uint32_t Calculator::GetCostFromDuration(Configuration * cfg,
|
||||||
QDateTime const &start,
|
QDateTime const &start,
|
||||||
QDateTime const &end,
|
QDateTime const &end) const {
|
||||||
uint8_t paymentMethod) {
|
if (cfg->YearPeriod.size() == 0
|
||||||
if (paymentMethod == PaymentMethod::Steps
|
|
||||||
&& cfg->SpecialDays.size() == 0
|
&& cfg->SpecialDays.size() == 0
|
||||||
&& cfg->SpecialDaysWorktime.size() == 0) {
|
&& cfg->SpecialDaysWorktime.size() == 0) {
|
||||||
int const timeStepInMinutes = start.secsTo(end) / 60;
|
int const timeStepInMinutes = start.secsTo(end) / 60;
|
||||||
return GetPriceForTimeStep(cfg, paymentMethod, timeStepInMinutes);
|
return GetPriceForTimeStep(cfg, timeStepInMinutes);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -386,12 +384,12 @@ uint32_t Calculator::GetCostFromDuration(Configuration const* cfg,
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
double Calculator::GetCostFromDuration(Configuration* cfg, uint8_t payment_option, const QDateTime start_datetime, QDateTime & end_datetime, double durationMin, bool nextDay, bool prepaid)
|
double Calculator::GetCostFromDuration(Configuration* cfg, uint8_t payment_option, const QDateTime start_datetime, QDateTime & end_datetime, double durationMin, bool nextDay, bool prepaid)
|
||||||
{
|
{
|
||||||
// condition for 'PaymentMethod::Steps' (e.g. 332/Schoenau):
|
if (cfg->YearPeriod.size() == 0
|
||||||
if (cfg->SpecialDays.size() == 0
|
&& cfg->SpecialDays.size() == 0
|
||||||
&& cfg->SpecialDaysWorktime.size() == 0)
|
&& cfg->SpecialDaysWorktime.size() == 0)
|
||||||
{
|
{
|
||||||
end_datetime = start_datetime.addSecs(durationMin*60);
|
end_datetime = start_datetime.addSecs(durationMin*60);
|
||||||
return GetCostFromDuration(cfg, start_datetime, end_datetime, PaymentMethod::Steps);
|
return GetCostFromDuration(cfg, start_datetime, end_datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get input date
|
// Get input date
|
||||||
|
Loading…
Reference in New Issue
Block a user