Return a ticket from private_GetCostFromDuration().
Add helpers findWorkTimeRange() and findNextWorkTimeRange().
This commit is contained in:
		@@ -1,7 +1,14 @@
 | 
				
			|||||||
#pragma once
 | 
					#ifndef CALCULATOR_FUNCTIONS_H_INCLUDED
 | 
				
			||||||
 | 
					#define CALCULATOR_FUNCTIONS_H_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <iostream>
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <optional>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "configuration.h"
 | 
					#include "configuration.h"
 | 
				
			||||||
#include "payment_method.h"
 | 
					#include "payment_method.h"
 | 
				
			||||||
 | 
					#include "ticket.h"
 | 
				
			||||||
 | 
					#include "tariff_time_range.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QDateTime>
 | 
					#include <QDateTime>
 | 
				
			||||||
using namespace std;
 | 
					using namespace std;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -49,10 +56,10 @@ private:
 | 
				
			|||||||
    int getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId);
 | 
					    int getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId);
 | 
				
			||||||
    int getMaximalParkingTime(Configuration const *cfg, PaymentMethod methodId);
 | 
					    int getMaximalParkingTime(Configuration const *cfg, PaymentMethod methodId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    uint32_t private_GetCostFromDuration(Configuration const* cfg,
 | 
					    Ticket private_GetCostFromDuration(Configuration const* cfg,
 | 
				
			||||||
                                       QDateTime const &start,
 | 
					                                       QDateTime const &start,
 | 
				
			||||||
                                       QDateTime &end,
 | 
					                                       QDateTime &end,
 | 
				
			||||||
                                         int durationMinutes,
 | 
					                                       int &durationMinutes,
 | 
				
			||||||
                                       bool nextDay = false,
 | 
					                                       bool nextDay = false,
 | 
				
			||||||
                                       bool prepaid = false,
 | 
					                                       bool prepaid = false,
 | 
				
			||||||
                                       bool overtime = false);
 | 
					                                       bool overtime = false);
 | 
				
			||||||
@@ -64,4 +71,13 @@ private:
 | 
				
			|||||||
    //
 | 
					    //
 | 
				
			||||||
    uint32_t GetPriceForTimeStep(Configuration *cfg, int timeStep) const;
 | 
					    uint32_t GetPriceForTimeStep(Configuration *cfg, int timeStep) const;
 | 
				
			||||||
    uint32_t GetDurationForPrice(Configuration *cfg, int price) const;
 | 
					    uint32_t GetDurationForPrice(Configuration *cfg, int price) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int findWorkTimeRange(QDateTime const &dt,
 | 
				
			||||||
 | 
					                          QScopedArrayPointer<TariffTimeRange> const &worktime,
 | 
				
			||||||
 | 
					                          size_t size);
 | 
				
			||||||
 | 
					    int findNextWorkTimeRange(QDateTime const &dt,
 | 
				
			||||||
 | 
					                              QScopedArrayPointer<TariffTimeRange> const &worktime,
 | 
				
			||||||
 | 
					                              size_t size);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // CALCULATOR_FUNCTIONS_H_INCLUDED
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user