Removed section whith superfluous 'price_per_unit < 0' check.

Removed calc_price-caculation followed by shift of inputDate.
This commit is contained in:
Gerhard Hoffmann 2023-06-13 12:12:23 +02:00
parent 6157861d62
commit eefdde4693

View File

@ -201,16 +201,9 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
if (price_per_unit < 0) price_per_unit = 1.0f;
if((price/price_per_unit) < minMin) return "PARKING NOT ALLOWED";
// if((price/price_per_unit) < minMin) return "PARKING NOT ALLOWED";
LOG_DEBUG("Calculated price per minute: ", price_per_unit);
if (price_per_unit < 0)
{
inputDate = inputDate.addDays(1);
inputDate.setTime(worktime_from);
return GetDurationFromCost(cfg, payment_option, inputDate.toString(Qt::ISODate).toStdString().c_str(), money_left, true);
}
// If overtime flag is set
if (overtime || nextDay)
{
@ -314,12 +307,12 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
// }
double ret_val = 0;
double calc_price = (int)total_duration_min - (int)price / price_per_unit;
// double calc_price = (int)total_duration_min - (int)price / price_per_unit;
if (calc_price > 0 && total_duration_min > 0)
{
inputDate = inputDate.addSecs(-(int)ceil(calc_price) * 60);
}
//if (calc_price > 0 && total_duration_min > 0)
//{
// inputDate = inputDate.addSecs(-(int)ceil(calc_price) * 60);
//}
if(price >= min_price && total_duration_min >= minMin)
qDebug() << "GetDurationFromCost(): Valid until: " << inputDate.toString(Qt::ISODate);