Use helper functions GetTimeStep() and GetPriceForTimeStep() inside of
GetCostFromDuration().
This commit is contained in:
parent
7508cb6c45
commit
6ea2ea7df7
@ -341,6 +341,15 @@ std::string Calculator::GetDurationFromCost(Configuration* 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)
|
||||||
{
|
{
|
||||||
|
if (cfg->project.project == "Schoenau" || cfg->project.project == "schoenau") {
|
||||||
|
static QList<int> const timeSteps = GetTimeSteps(cfg, payment_option);
|
||||||
|
if (!timeSteps.contains(durationMin)) {
|
||||||
|
return 0.0f; // error: timestep not valid
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetPriceForTimeStep(cfg, payment_option, durationMin);
|
||||||
|
}
|
||||||
|
|
||||||
// Get input date
|
// Get input date
|
||||||
QDateTime inputDate = start_datetime;
|
QDateTime inputDate = start_datetime;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user