Compare commits

...

14 Commits

Author SHA1 Message Date
ae985d25ce Merge branch 'kleipeda-experimental' 2025-02-04 14:58:58 +01:00
6a215d4cf9 Allow zone_nr > 999 2025-02-04 14:47:07 +01:00
a3f4a742ce Read zone_nr from system_data 2025-02-04 14:44:28 +01:00
e6d8c04076 Fix: for time change summer -> winter term. Compute minutes until midnight manually. 2024-10-30 15:56:58 +01:00
1f6606f382 Add some tests for Forchach (749) 2024-10-10 11:40:29 +02:00
4b9a4319b3 ComputeDurationFromCost():
Fix: take into account that there may be more than just two
	carry-over-ranges. For instance, in Korneuburg (714), there are three
	as they have a break from 12:00-14:00.
2024-10-10 11:38:14 +02:00
5e673788b4 ComputeDurationFromCost():
Use helper function computeMinutesUntilCarryOverEnd() to compute
	the offset until the end of the carry-over-range.
2024-10-10 11:36:14 +02:00
7e2f40a7b5 Add assigment-operator (otherwise compilation error). 2024-10-10 11:33:33 +02:00
44e2ce24a3 Add helper computeMinutesUntilCarryOverEnd().
Used in new tariff-calculator. Replace of previous wrong approach of
        using m_range.duration.
2024-10-10 11:30:53 +02:00
5a55ad6ef0 ComputeDurationFromCost():
brutto-time must be updated in case of an carry-over-section.
2024-10-02 15:21:21 +02:00
5a77958e8d getOutOfService():
Check for special days (holidays) with out-of-service-time-ranges.
	Holidays have higher priority than usual days ("default").
2024-10-02 15:19:32 +02:00
a1e7f4629a getService():
Check for special days (holidays) with service-time-ranges.
	Holidays have higher priority than usual days ("default").
2024-10-02 15:18:16 +02:00
efc2582c36 getCarryOver():
Check for special days (holidays) with carry-over-sections.
	Holidays have higher priority than usual days.
2024-10-02 15:17:00 +02:00
a72f5a5019 getPrepaid():
Check for special days (holidays) with prepaid sections.
	Holidays have higher priority than usual days.
2024-10-02 15:15:19 +02:00
5 changed files with 313 additions and 65 deletions

View File

@@ -61,6 +61,37 @@ struct ATBTariffCarryOver {
return QString("ERROR unknown carry over application: %1").arg(static_cast<int>(m_carryOverIf));
}
int computeMinutesUntilCarryOverEnd(QDateTime const &dt) {
int minutes = 0;
QString end = m_range.m_end.toString(Qt::ISODate);
if (end == "24:00:00") {
// note: this did not work
// QDateTime t(dt.addDays(1));
// t.setTime(QTime(0,0,0));
// dt: 2024-10-27T00:00:00 EEST, but t: 2024-10-28T00:00:00 EET (!)
// so the difference is 1500 instead of 1440
// reason: change from summer to winter time
// compute minutes directly
if (dt.time().isValid()) {
minutes = 1440 - (dt.time().hour() * 60 + dt.time().minute());
}
} else {
QTime t(QTime::fromString(end, Qt::ISODate));
if (t.isValid() && dt.time().isValid()) {
minutes = (t.hour() * 60 + t.minute()) - (dt.time().hour() * 60 + dt.time().minute());
}
}
if (minutes < 0 || minutes > m_range.m_duration) {
minutes = 0;
}
// qCritical() << __func__ << ":" << __LINE__ << "minutes" << minutes;
return minutes;
}
friend QDebug operator<<(QDebug debug, ATBTariffCarryOver const &co) {
QDebugStateSaver saver(debug);

View File

@@ -34,6 +34,13 @@ struct TimeRange {
m_duration = timeRange.m_duration;
return *this;
}
TimeRange &operator=(TimeRange const &timeRange) {
m_start = timeRange.m_start;
m_end = timeRange.m_end;
m_duration = timeRange.m_duration;
return *this;
}
};
#endif // TIME_RANGE_H_INCLUDED

View File

@@ -396,14 +396,12 @@ int CALCULATE_LIBRARY_API get_zone_nr(int zone)
if(zone > -1) return zone;
else
{
QFile zone("/etc/zone_nr");
QFile zone("/mnt/system_data/zone_nr");
if (zone.exists()) {
QFileInfo finfo(zone);
if (finfo.size() <= 4) { // decimal 000\n
if (zone.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&zone);
return in.readLine(100).toInt();
}
if (zone.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&zone);
return in.readLine(100).toInt();
}
}
return -1;

View File

@@ -131,17 +131,52 @@ std::optional<ATBTariffPrepaid> getPrepaid(Configuration const *cfg, QDateTime c
std::optional<ATBTariffPrepaid> value = std::nullopt;
int weekDay = dt.date().dayOfWeek();
// qCritical() << __func__ << ":" << __LINE__ << dt.toString(Qt::ISODate) << weekDay;
ATBTime inputTime(dt.time());
QDate d; // check if a special date is configured in tariff-file for this day
auto const &prepaidRange = cfg->TariffPrepaids.equal_range(weekDay);
for (auto i = prepaidRange.first; i != prepaidRange.second; ++i) {
ATBTariffPrepaid const &prepaid = i->second;
TimeRange const &prepaidTimeRange = prepaid.m_range;
if (inputTime >= prepaidTimeRange.m_start && inputTime < prepaidTimeRange.m_end) {
value = value.value_or(i->second);
if (!prepaid.m_date.isNull() && prepaid.m_date.isValid() && prepaid.m_date == dt.date()) {
d = dt.date();
// qCritical() << __func__ << ":" << __LINE__ << "found special day" << d.toString(Qt::ISODate);
break;
}
}
if (!d.isNull() && d.isValid()) {
for (auto i = prepaidRange.first; i != prepaidRange.second; ++i) {
ATBTariffPrepaid const &prepaid = i->second;
if (!prepaid.m_date.isNull() && prepaid.m_date.isValid() && prepaid.m_date == d) {
TimeRange const &prepaidTimeRange = prepaid.m_range;
if (inputTime >= prepaidTimeRange.m_start && inputTime < prepaidTimeRange.m_end) {
// qCritical() << __func__ << ":" << __LINE__ << prepaidTimeRange.m_start.toString(Qt::ISODate);
// qCritical() << __func__ << ":" << __LINE__ << prepaidTimeRange.m_end.toString(Qt::ISODate);
value = value.value_or(i->second);
break;
}
}
}
} else {
// qCritical() << __func__ << ":" << __LINE__ << "no special day" << dt.date().toString(Qt::ISODate);
for (auto i = prepaidRange.first; i != prepaidRange.second; ++i) {
ATBTariffPrepaid const &prepaid = i->second;
if (prepaid.m_date.isNull() || !prepaid.m_date.isValid()) {
qCritical() << __func__ << ":" << __LINE__ << "default";
TimeRange const &prepaidTimeRange = prepaid.m_range;
if (inputTime >= prepaidTimeRange.m_start && inputTime < prepaidTimeRange.m_end) {
// qCritical() << __func__ << ":" << __LINE__ << prepaidTimeRange.m_start.toString(Qt::ISODate);
// qCritical() << __func__ << ":" << __LINE__ << prepaidTimeRange.m_end.toString(Qt::ISODate);
value = value.value_or(i->second);
break;
}
}
}
}
return value;
}
@@ -161,17 +196,48 @@ std::optional<ATBTariffCarryOver> getCarryOver(Configuration const *cfg, QDateTi
ATBTime inputTime(dt.time());
auto const &carryOverRange = cfg->TariffCarryOvers.equal_range(weekDay);
QDate d; // check if a special date is configured in tariff-file for this day
for (auto i = carryOverRange.first; i != carryOverRange.second; ++i) {
ATBTariffCarryOver const &carryOver = i->second;
TimeRange const &carryOverTimeRange = carryOver.m_range;
if (inputTime >= carryOverTimeRange.m_start && inputTime < carryOverTimeRange.m_end) {
// qCritical() << __func__ << ":" << __LINE__ << carryOverTimeRange.m_start.toString(Qt::ISODate);
// qCritical() << __func__ << ":" << __LINE__ << carryOverTimeRange.m_end.toString(Qt::ISODate);
value = value.value_or(carryOver);
if (!carryOver.m_date.isNull() && carryOver.m_date.isValid() && carryOver.m_date == dt.date()) {
d = dt.date();
// qCritical() << __func__ << ":" << __LINE__ << "found special day" << d.toString(Qt::ISODate);
break;
}
}
if (!d.isNull() && d.isValid()) {
for (auto i = carryOverRange.first; i != carryOverRange.second; ++i) {
ATBTariffCarryOver const &carryOver = i->second;
if (!carryOver.m_date.isNull() && carryOver.m_date.isValid() && carryOver.m_date == d) {
TimeRange const &carryOverTimeRange = carryOver.m_range;
if (inputTime >= carryOverTimeRange.m_start && inputTime < carryOverTimeRange.m_end) {
// qCritical() << __func__ << ":" << __LINE__ << carryOverTimeRange.m_start.toString(Qt::ISODate);
// qCritical() << __func__ << ":" << __LINE__ << carryOverTimeRange.m_end.toString(Qt::ISODate);
value = value.value_or(carryOver);
break;
}
}
}
} else {
// qCritical() << __func__ << ":" << __LINE__ << "no special day" << dt.date().toString(Qt::ISODate);
for (auto i = carryOverRange.first; i != carryOverRange.second; ++i) {
ATBTariffCarryOver const &carryOver = i->second;
if (carryOver.m_date.isNull() || !carryOver.m_date.isValid()) {
// qCritical() << __func__ << ":" << __LINE__ << "default";
TimeRange const &carryOverTimeRange = carryOver.m_range;
if (inputTime >= carryOverTimeRange.m_start && inputTime < carryOverTimeRange.m_end) {
// qCritical() << __func__ << ":" << __LINE__ << carryOverTimeRange.m_start.toString(Qt::ISODate);
// qCritical() << __func__ << ":" << __LINE__ << carryOverTimeRange.m_end.toString(Qt::ISODate);
value = value.value_or(carryOver);
break;
}
}
}
}
return value;
}
@@ -186,17 +252,53 @@ std::optional<ATBTariffService> getService(Configuration const *cfg, QDateTime c
std::optional<ATBTariffService> value = std::nullopt;
int weekDay = dt.date().dayOfWeek();
// qCritical() << __func__ << ":" << __LINE__ << dt.toString(Qt::ISODate) << weekDay;
ATBTime inputTime(dt.time());
auto const &serviceRange = cfg->TariffServices.equal_range(weekDay);
QDate d; // check if a special date is configured in tariff-file for this day
for (auto i = serviceRange.first; i != serviceRange.second; ++i) {
ATBTariffService const &service = i->second;
TimeRange const &serviceTimeRange = service.m_range;
if (inputTime >= serviceTimeRange.m_start && inputTime < serviceTimeRange.m_end) {
value = value.value_or(i->second);
if (!service.m_date.isNull() && service.m_date.isValid() && service.m_date == dt.date()) {
d = dt.date();
// qCritical() << __func__ << ":" << __LINE__ << "found special day" << d.toString(Qt::ISODate);
break;
}
}
if (!d.isNull() && d.isValid()) {
for (auto i = serviceRange.first; i != serviceRange.second; ++i) {
ATBTariffService const &service = i->second;
if (!service.m_date.isNull() && service.m_date.isValid() && service.m_date == d) {
TimeRange const &serviceTimeRange = service.m_range;
if (inputTime >= serviceTimeRange.m_start && inputTime < serviceTimeRange.m_end) {
// qCritical() << __func__ << ":" << __LINE__ << serviceTimeRange.m_start.toString(Qt::ISODate);
// qCritical() << __func__ << ":" << __LINE__ << serviceTimeRange.m_end.toString(Qt::ISODate);
value = value.value_or(service);
break;
}
}
}
} else {
// qCritical() << __func__ << ":" << __LINE__ << "no special day" << dt.date().toString(Qt::ISODate);
for (auto i = serviceRange.first; i != serviceRange.second; ++i) {
ATBTariffService const &service = i->second;
if (service.m_date.isNull() || !service.m_date.isValid()) {
// qCritical() << __func__ << ":" << __LINE__ << "default";
TimeRange const &serviceTimeRange = service.m_range;
if (inputTime >= serviceTimeRange.m_start && inputTime < serviceTimeRange.m_end) {
// qCritical() << __func__ << ":" << __LINE__ << serviceTimeRange.m_start.toString(Qt::ISODate);
// qCritical() << __func__ << ":" << __LINE__ << serviceTimeRange.m_end.toString(Qt::ISODate);
value = value.value_or(service);
break;
}
}
}
}
return value;
}
@@ -210,29 +312,50 @@ std::optional<ATBTariffOutOfService> getOutOfService(Configuration const *cfg, Q
std::optional<ATBTariffOutOfService> value = std::nullopt;
int weekDay = dt.date().dayOfWeek();
// qCritical() << __func__ << ":" << __LINE__ << dt.toString(Qt::ISODate) << weekDay;
ATBTime inputTime(dt.time());
QDate date;
auto const &outOfServiceRange = cfg->TariffOutOfServices.equal_range(weekDay);
QDate d; // check if a special date is configured in tariff-file for this day
for (auto i = outOfServiceRange.first; i != outOfServiceRange.second; ++i) {
ATBTariffOutOfService const &outOfService = i->second;
TimeRange const &outOfServiceTimeRange = outOfService.m_range;
if (outOfService.m_date == dt.date()) {
date = dt.date();
if (inputTime >= outOfServiceTimeRange.m_start && inputTime < outOfServiceTimeRange.m_end) {
value = value.value_or(i->second);
return value;
}
if (!outOfService.m_date.isNull() && outOfService.m_date.isValid() && outOfService.m_date == dt.date()) {
d = dt.date();
// qCritical() << __func__ << ":" << __LINE__ << "found special day" << d.toString(Qt::ISODate);
break;
}
}
if (date.isNull() || !date.isValid()) {
if (!d.isNull() && d.isValid()) {
for (auto i = outOfServiceRange.first; i != outOfServiceRange.second; ++i) {
ATBTariffOutOfService const &outOfService = i->second;
TimeRange const &outOfServiceTimeRange = outOfService.m_range;
if (inputTime >= outOfServiceTimeRange.m_start && inputTime < outOfServiceTimeRange.m_end) {
value = value.value_or(i->second);
return value;
if (!outOfService.m_date.isNull() && outOfService.m_date.isValid() && outOfService.m_date == d) {
TimeRange const &outOfServiceTimeRange = outOfService.m_range;
if (inputTime >= outOfServiceTimeRange.m_start && inputTime < outOfServiceTimeRange.m_end) {
// qCritical() << __func__ << ":" << __LINE__ << outOfServiceTimeRange.m_start.toString(Qt::ISODate);
// qCritical() << __func__ << ":" << __LINE__ << outOfServiceTimeRange.m_end.toString(Qt::ISODate);
value = value.value_or(outOfService);
break;
}
}
}
} else {
// qCritical() << __func__ << ":" << __LINE__ << "no special day" << dt.date().toString(Qt::ISODate);
for (auto i = outOfServiceRange.first; i != outOfServiceRange.second; ++i) {
ATBTariffOutOfService const &outOfService = i->second;
if (outOfService.m_date.isNull() || !outOfService.m_date.isValid()) {
// qCritical() << __func__ << ":" << __LINE__ << "default";
TimeRange const &outOfServiceTimeRange = outOfService.m_range;
if (inputTime >= outOfServiceTimeRange.m_start && inputTime < outOfServiceTimeRange.m_end) {
// qCritical() << __func__ << ":" << __LINE__ << outOfServiceTimeRange.m_start.toString(Qt::ISODate);
// qCritical() << __func__ << ":" << __LINE__ << outOfServiceTimeRange.m_end.toString(Qt::ISODate);
value = value.value_or(outOfService);
break;
}
}
}
}
@@ -335,7 +458,7 @@ Calculator::ComputeDurationFromCost(Configuration *cfg,
arg(cost).arg(nettoParktimeForCost);
int cnt = 0;
while (++cnt < 1000 && netto_parking_time_in_minutes < nettoParktimeForCost) {
while (++cnt < 10 && netto_parking_time_in_minutes < nettoParktimeForCost) {
// qCritical() << __func__ << ":" << __LINE__ << "cnt [" << cnt;
brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes;
@@ -431,22 +554,24 @@ Calculator::ComputeDurationFromCost(Configuration *cfg,
.arg(netto_parking_time_in_minutes)
.arg(free_parking_time_in_minutes);
if (std::optional<ATBTariffCarryOver> co = getCarryOver(cfg, inputDate.addSecs(brutto_parking_time_in_minutes * 60))) {
TimeRange const &carryOverTimeRange = co.value().m_range;
free_parking_time_in_minutes += carryOverTimeRange.m_duration;
if (std::optional<ATBTariffCarryOver> co = getCarryOver(cfg, dt)) {
int minutes = co.value().computeMinutesUntilCarryOverEnd(dt);
if (minutes > 0) {
free_parking_time_in_minutes += minutes;
brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes;
dt = inputDate.addSecs(brutto_parking_time_in_minutes * 60);
weekDay = dt.date().dayOfWeek();
qCritical() << __func__ << ":" << __LINE__ << QString("%1 (%2): brutto: %3 = netto: %4 + free: %5")
.arg(dt.toString(Qt::ISODate))
.arg(weekDay)
.arg(brutto_parking_time_in_minutes)
.arg(netto_parking_time_in_minutes)
.arg(free_parking_time_in_minutes);
}
}
brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes;
dt = inputDate.addSecs(brutto_parking_time_in_minutes * 60);
weekDay = dt.date().dayOfWeek();
qCritical() << __func__ << ":" << __LINE__ << QString("%1 (%2): brutto: %3 = netto: %4 + free: %5")
.arg(dt.toString(Qt::ISODate))
.arg(weekDay)
.arg(brutto_parking_time_in_minutes)
.arg(netto_parking_time_in_minutes)
.arg(free_parking_time_in_minutes);
if (std::optional<ATBTariffService> serv = getService(cfg, dt)) {
TimeRange const &serviceTimeRange = serv.value().m_range;
@@ -454,6 +579,8 @@ Calculator::ComputeDurationFromCost(Configuration *cfg,
int rest_parking_time_in_minutes = nettoParktimeForCost - netto_parking_time_in_minutes;
ATBTime t(dt.time().hour(), dt.time().minute(), 0, 0);
int timeToServiceEnd = t.secsTo(serviceTimeRange.m_end.toString(Qt::ISODate)) / 60;
// TODO: wohl aehnlich wie carry-over zu behandlen
if (serviceTimeRange.m_duration > 0) {
if (timeToServiceEnd < rest_parking_time_in_minutes) {
netto_parking_time_in_minutes += timeToServiceEnd;
@@ -478,20 +605,41 @@ Calculator::ComputeDurationFromCost(Configuration *cfg,
// qCritical() << __func__ << ":" << __LINE__ << "cnt" << cnt << "]";
}
if (cnt >= 1000) {
if (cnt >= 10) {
qCritical() << __func__ << ":" << __LINE__ << "BREAK";
}
// configure if last carry-over ranges shall be added to ticket-end-time
dt = inputDate.addSecs(brutto_parking_time_in_minutes * 60);
cnt = 0;
while (std::optional<ATBTariffCarryOver> co = getCarryOver(cfg, inputDate.addSecs(brutto_parking_time_in_minutes * 60))) {
if (++cnt > 5) {
qCritical() << __func__ << ":" << __LINE__ << "BREAK";
QVector<TimeRange> timeRanges;
while (std::optional<ATBTariffCarryOver> co = getCarryOver(cfg, dt)) {
if (++cnt > 10) {
break;
}
TimeRange const &carryOverTimeRange = co.value().m_range;
free_parking_time_in_minutes += carryOverTimeRange.m_duration;
brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes;
if (!timeRanges.isEmpty()) {
if (timeRanges.last().m_end != carryOverTimeRange.m_start) {
break;
}
}
timeRanges.push_back(carryOverTimeRange);
int minutes = co.value().computeMinutesUntilCarryOverEnd(dt);
if (minutes > 0) {
free_parking_time_in_minutes += co.value().computeMinutesUntilCarryOverEnd(dt);
brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes;
qCritical() << __func__ << ":" << __LINE__ << QString("%1 (%2): brutto: %3 = netto: %4 + free: %5")
.arg(dt.toString(Qt::ISODate))
.arg(weekDay)
.arg(brutto_parking_time_in_minutes)
.arg(netto_parking_time_in_minutes)
.arg(free_parking_time_in_minutes);
dt = inputDate.addSecs(brutto_parking_time_in_minutes * 60);
} else break;
}
brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes;

View File

@@ -39,11 +39,11 @@ extern "C" char* strptime(const char* s,
#define SZEGED (0)
#define SCHOENAU_KOENIGSEE (0)
#define NEUHAUSER_KORNEUBURG (0)
#define NEUHAUSER_KORNEUBURG (1)
#define NEUHAUSER_LINSINGER_MASCHINENBAU (0)
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0)
#define NEUHAUSER_BILEXA_GALTUER (0)
#define BAD_NEUENAHR_AHRWEILER (1)
#define BAD_NEUENAHR_AHRWEILER (0)
#define NEUHAUSER_CHRISTOPH_REISEN (0)
#define NEUHAUSER_PERNEGG_AN_DER_MUR (0)
#define NEUHAUSER_STOCKERAU (0)
@@ -52,6 +52,7 @@ extern "C" char* strptime(const char* s,
#define SCHNALS_LEITER_KIRCHL (0)
#define SCHNALS_STAUMAUER (SCHNALS_LEITER_KIRCHL)
#define VALSER_ALM (0)
#define NEUHAUSER_FORCHACH (0)
#if NEUHAUSER_KIRCHDORF==1
static bool test_neuhauser_kirchdorf(int step, double cost) {
@@ -1386,6 +1387,29 @@ int main() {
}
}
#endif
#if NEUHAUSER_FORCHACH==1
std::ifstream input;
input.open("/opt/ptu5/opt/customer_749/etc/psa_tariff/tariff01.json");
std::stringstream sstr;
while(input >> sstr.rdbuf());
std::string json(sstr.str());
Configuration cfg;
bool isParsed = cfg.ParseJson(&cfg, json.c_str());
cout << endl;
if (isParsed) {
compute_product_price(&cfg, PermitType(PERMIT_TYPE::DAY_TICKET_PKW));
compute_product_price(&cfg, PermitType(PERMIT_TYPE::DAY_TICKET_CAMPER));
QDateTime start = QDateTime::currentDateTime();
QDateTime ticketEndTime;
compute_duration_for_daily_ticket(&cfg, start, ticketEndTime, PermitType(PERMIT_TYPE::DAY_TICKET));
}
#endif
#if BAD_NEUENAHR_AHRWEILER==1
std::ifstream input;
@@ -2780,24 +2804,62 @@ int main() {
bool nextDay = false;
bool prePaid = true;
// zone 1 (lila)
QDateTime s(QDate(2023, 11, 30), QTime());
QDateTime s(QDate(2024, 10, 8), QTime());
QDateTime end;
static QList<int> const timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg);
qCritical() << "TimeSteps" << timeSteps;
for (int duration = 30; duration <= pop_max_time; duration += 5) {
for (int offset = 420; offset < 1140; ++offset) {
if (offset > 720 && offset < 840) {
continue;
}
int offset = 600;
//for (int offset = 720; offset < 601; ++offset) {
//if (offset > 720 && offset < 840) {
// continue;
//}
QDateTime start = s.addSecs(offset * 60);
//qCritical() << "start" << start.toString(Qt::ISODate);
double cost = Calculator::GetInstance().GetCostFromDuration(&cfg, 3, start, end, duration, nextDay, prePaid);
CalcState cs;
#if 1
struct price_t costs;
for (int i = 0, j=timeSteps.size() ; i < timeSteps.size(); --j, ++i) {
QDateTime end = start.addSecs(timeSteps.at(i)*60);
// if (i != 2) continue;
cs = compute_price_for_parking_ticket(&cfg, start, timeSteps.at(i), end, &costs, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
int price1 = costs.netto;
qCritical() << "compute_price_for_parking_ticket()/GetCostFromDuration() TIME: "
<< timeSteps.at(i) << "ZZZZZZZZZZZZZ PRICE=" << price1 << "end=" << end.toString(Qt::ISODate);
}
exit(0);
#else
double cost = 360;
qCritical() << "XXXXXXXX START" << start.toString(Qt::ISODate) << "cost" << cost;
QDateTime end;
cs = compute_duration_for_parking_ticket(&cfg, start, cost, end,
PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
qCritical() << __LINE__ << cs.toString()
<< "START" << start.toString(Qt::ISODate)
<< "<duration" << start.secsTo(end) / 60
<< "cost" << cost
<< "> end" << end.toString(Qt::ISODate);
//}
exit(0);
#endif
//double cost = Calculator::GetInstance().GetCostFromDuration(&cfg, 3, start, end, duration, nextDay, prePaid);
//Q_ASSERT(cost == duration*2.5);
//qCritical() << "";
qCritical() << "start" << start.toString(Qt::ISODate)
<< "end" << end.toString(Qt::ISODate)
<< "duration" << duration
<< "cost" << cost;
//qCritical() << "start" << start.toString(Qt::ISODate)
// << "end" << end.toString(Qt::ISODate)
// << "duration" << duration
// << "cost" << cost;
#if 0
switch(duration) {
case 30:
if (cost == 60.0) {
@@ -2961,15 +3023,17 @@ int main() {
<< "cost" << cost;
exit(-1);
}
#endif
//std::string duration = Calculator::GetInstance().GetDurationFromCost(&cfg, 3, start.toString(Qt::ISODate).toStdString().c_str(), cost);
//Q_ASSERT(cost == duration*2.5);
//qCritical() << "start" << start.toString(Qt::ISODate)
// << "cost" << cost
// << "until" << duration.c_str() << start.secsTo(QDateTime::fromString(duration.c_str(), Qt::ISODate)) / 60;
}
//}
}
#if 0
Configuration::SpecialDaysType specialDays = cfg.SpecialDays;
for (Configuration::SpecialDaysType::const_iterator it = specialDays.cbegin();
it != specialDays.cend(); ++it) {
@@ -2990,7 +3054,7 @@ int main() {
<< "duration" << duration
<< "cost" << cost;
}
#endif
}
}
return 0;