Merge branch 'moransBranch' of git.mimbach49.de:GerhardHoffmann/MOBILISIS-Calculator into moransBranch
This commit is contained in:
commit
de32022b89
@ -213,12 +213,12 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
|
|||||||
//qDebug() <<"Timestamp:" << inputDate << ", total duration min: " << total_duration_min << ", money left = " << money_left;
|
//qDebug() <<"Timestamp:" << inputDate << ", total duration min: " << total_duration_min << ", money left = " << money_left;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((total_duration_min < minMin) || (price / price_per_unit) < minMin)
|
// if ((total_duration_min < minMin) || (price / price_per_unit) < minMin)
|
||||||
{
|
// {
|
||||||
LOG_DEBUG("Total duration is lower than min_min");
|
// LOG_DEBUG("Total duration is lower than min_min");
|
||||||
inputDate.time() = worktime_from;
|
// inputDate.time() = worktime_from;
|
||||||
total_duration_min = 0;
|
// total_duration_min = 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
double ret_val = 0;
|
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;
|
||||||
@ -227,12 +227,16 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
|
|||||||
{
|
{
|
||||||
inputDate.addSecs(-(int)ceil(calc_price) * 60);
|
inputDate.addSecs(-(int)ceil(calc_price) * 60);
|
||||||
}
|
}
|
||||||
ret_val = total_duration_min;
|
|
||||||
|
|
||||||
if(price >= min_price && total_duration_min >= minMin)
|
if(price >= min_price && total_duration_min >= minMin)
|
||||||
qDebug() << "Valid until: " << inputDate.toString(Qt::ISODate);
|
qDebug() << "Valid until: " << inputDate.toString(Qt::ISODate);
|
||||||
else qDebug() << "Parking not allowed";
|
else
|
||||||
|
{
|
||||||
|
qDebug() << "Parking not allowed";
|
||||||
|
total_duration_min = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret_val = total_duration_min;
|
||||||
if(ret_val < 0) ret_val = 0;
|
if(ret_val < 0) ret_val = 0;
|
||||||
qDebug() << "Duration: " << ret_val;
|
qDebug() << "Duration: " << ret_val;
|
||||||
if (ret_val <= 0) return "PARKING NOT ALLOWED";
|
if (ret_val <= 0) return "PARKING NOT ALLOWED";
|
||||||
|
@ -36,7 +36,7 @@ int main() {
|
|||||||
memset(&price, 0x00, sizeof(price));
|
memset(&price, 0x00, sizeof(price));
|
||||||
QDateTime start = QDateTime::fromString("2023-05-11T07:50:00",Qt::ISODate); //QDateTime::currentDateTime();
|
QDateTime start = QDateTime::fromString("2023-05-11T07:50:00",Qt::ISODate); //QDateTime::currentDateTime();
|
||||||
time_t start_parking_time = start.toSecsSinceEpoch() / 60;
|
time_t start_parking_time = start.toSecsSinceEpoch() / 60;
|
||||||
time_t end_parking_time = start_parking_time + 1236;
|
time_t end_parking_time = start_parking_time + 610;
|
||||||
|
|
||||||
if (compute_price_for_parking_ticket(tariff,
|
if (compute_price_for_parking_ticket(tariff,
|
||||||
start_parking_time,
|
start_parking_time,
|
||||||
@ -46,7 +46,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString duration;
|
QString duration;
|
||||||
if(compute_duration_for_parking_ticket(tariff,start_parking_time,3090,duration))
|
if(compute_duration_for_parking_ticket(tariff,start_parking_time,1525,duration))
|
||||||
{
|
{
|
||||||
qDebug() << "GetDurationFromCost() => duration=" << duration;
|
qDebug() << "GetDurationFromCost() => duration=" << duration;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user