Implement GetCostFromDuration() in terms of private_GetCostFromDuration()
using a ticket as return value.
This commit is contained in:
parent
2d9ed3c1c8
commit
2b6d116200
@ -3,6 +3,7 @@
|
|||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
#include "tariff_log.h"
|
#include "tariff_log.h"
|
||||||
#include "tariff_time_range.h"
|
#include "tariff_time_range.h"
|
||||||
|
#include "ticket.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -404,9 +405,18 @@ double Calculator::GetCostFromDuration(Configuration* cfg,
|
|||||||
return GetCostFromDuration(cfg, start_datetime, end_datetime);
|
return GetCostFromDuration(cfg, start_datetime, end_datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
return private_GetCostFromDuration(cfg, start_datetime,
|
QDateTime start = start_datetime;
|
||||||
|
|
||||||
|
Ticket t = private_GetCostFromDuration(cfg, start,
|
||||||
end_datetime, durationMinutes,
|
end_datetime, durationMinutes,
|
||||||
nextDay, prepaid);
|
nextDay, prepaid);
|
||||||
|
if (t) {
|
||||||
|
qCritical().noquote() << t;
|
||||||
|
|
||||||
|
return t.getPrice();
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Calculator::getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId) {
|
int Calculator::getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user