Use helper functions GetTimeStep() and GetPriceForTimeStep() inside of
GetCostFromDuration().
This commit is contained in:
		@@ -341,6 +341,15 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
 | 
			
		||||
/// <inheritdoc/>
 | 
			
		||||
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
 | 
			
		||||
    QDateTime inputDate = start_datetime;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user