Allow adjustment of the step list by a tolerance of 5 minutes per step
This commit is contained in:
		@@ -410,12 +410,14 @@ int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int cu
 | 
			
		||||
            maxStep = stepList[1] - stepList[0];
 | 
			
		||||
        }
 | 
			
		||||
        int tolerance = (maxStep == -1) ? 5 : std::min(maxStep, 5);
 | 
			
		||||
        if (std::abs(stepList[0] - currentTimeMinutes) <= tolerance) {
 | 
			
		||||
            qCritical().noquote()
 | 
			
		||||
                << QString("   compute_next_timestep() correction stepList[0]=%1 -> %2:")
 | 
			
		||||
                                    .arg(stepList[0]).arg(currentTimeMinutes);
 | 
			
		||||
            stepList[0] = currentTimeMinutes;
 | 
			
		||||
            qCritical() << "   compute_next_timestep()        NEW timeSteps:" << stepList;
 | 
			
		||||
        for (int i=0; i < stepList.size(); ++i) {
 | 
			
		||||
            if (std::abs(stepList[i] - currentTimeMinutes) <= tolerance) {
 | 
			
		||||
                qCritical().noquote()
 | 
			
		||||
                    << QString("   compute_next_timestep() correction stepList[%1]=%2 -> %3:")
 | 
			
		||||
                                    .arg(i).arg(stepList[0]).arg(currentTimeMinutes);
 | 
			
		||||
                stepList[i] = currentTimeMinutes;
 | 
			
		||||
                qCritical() << "   compute_next_timestep()        NEW timeSteps:" << stepList;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        int currentStepIndex = stepList.indexOf(currentTimeMinutes);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user