Implement GetCostFromDuration() in terms of private_GetCostFromDuration()

using a ticket as return value.
This commit is contained in:
Gerhard Hoffmann 2023-11-27 16:18:06 +01:00
parent 2d9ed3c1c8
commit 2b6d116200

View File

@ -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;
end_datetime, durationMinutes,
nextDay, prepaid); Ticket t = private_GetCostFromDuration(cfg, start,
end_datetime, durationMinutes,
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) {