Merge branch 'kleipeda-experimental-snapshot-2024-09-12' into kleipeda-experimental

This commit is contained in:
Gerhard Hoffmann 2024-09-16 10:49:23 +02:00
commit 1874b08210
5 changed files with 159 additions and 72 deletions

View File

@ -3,6 +3,7 @@
#include <iostream> #include <iostream>
#include <optional> #include <optional>
#include <utility>
#include "configuration.h" #include "configuration.h"
#include "calculate_price.h" #include "calculate_price.h"
@ -70,7 +71,8 @@ public:
/// <param name="start_datetime">Date/time of payment to be conducted in ISO8601 format (e.g. 2022-12-25T08:00:00Z)</param> /// <param name="start_datetime">Date/time of payment to be conducted in ISO8601 format (e.g. 2022-12-25T08:00:00Z)</param>
/// <param name="price"></param> /// <param name="price"></param>
/// <returns>Returns duration in seconds (data type: double)</returns> /// <returns>Returns duration in seconds (data type: double)</returns>
std::string GetDurationFromCost(Configuration* cfg, uint8_t vehicle_type, char const* start_datetime, double price, std::pair<std::string, QDateTime>
GetDurationFromCost(Configuration* cfg, uint8_t vehicle_type, char const* start_datetime, double price,
PermitType permitType, bool nextDay = false, bool prepaid = false); PermitType permitType, bool nextDay = false, bool prepaid = false);
/// <summary> /// <summary>

View File

@ -9,4 +9,8 @@ public:
std::string pedwt_time_from; std::string pedwt_time_from;
std::string pedwt_time_to; std::string pedwt_time_to;
double pedwt_price; double pedwt_price;
int pedwt_paid; // 00: not paid (i.e. free)
// 01: not paid in winter term, piad in summer term
// 10: paid in winter term, not paid in summer term
// 11: paid in winter and in summer term
}; };

View File

@ -808,22 +808,48 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
int pop_prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id; int pop_prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id;
std::optional<ATBPeriodYear> yperiod = Utilities::GetYearPeriodActive(tariff, start_parking_time); std::optional<ATBPeriodYear> yperiod = Utilities::GetYearPeriodActive(tariff, start_parking_time);
int period_id = -1;
if (yperiod.has_value()) { if (yperiod.has_value()) {
ATBPeriodYear const &period = yperiod.value(); ATBPeriodYear const &period = yperiod.value();
period_id = period.pye_id;
pop_carry_over_option_id = period.pye_id; pop_carry_over_option_id = period.pye_id;
pop_prepaid_option_id = period.pye_id; pop_prepaid_option_id = period.pye_id;
qCritical() << __func__ << ":" << __LINE__ << "re-computed carry-over-id" << pop_carry_over_option_id; qCritical() << __func__ << ":" << __LINE__ << "re-computed carry-over-id" << pop_carry_over_option_id;
qCritical() << __func__ << ":" << __LINE__ << " re-computed prepaid-id" << pop_prepaid_option_id; qCritical() << __func__ << ":" << __LINE__ << " re-computed prepaid-id" << pop_prepaid_option_id;
} }
QTime carryOverStart = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].static_start; QDateTime effectiveStartTime(start_parking_time);
int carryOverDuration = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].duration;
qCritical() << __func__ << ":" << __LINE__ << " carryOverStart" << carryOverStart.toString(Qt::ISODate); // handle special days
qCritical() << __func__ << ":" << __LINE__ << "carryOverDuration" << carryOverDuration; int const specialDayId = tariff->specialDayId(start_parking_time);
if (specialDayId > 0) { // found special day
for (auto[itr, rangeEnd] = tariff->SpecialDaysWorktime.equal_range(specialDayId); itr != rangeEnd; ++itr) {
ATBSpecialDaysWorktime const &wt = itr->second;
switch(period_id) {
case 1: // summer term
if ((wt.pedwt_paid & 1) == 0) {
// does not have to be paid, move to next midnight
// better: start of next day (falls kein vorkauf besteht)
effectiveStartTime = effectiveStartTime.addDays(1);
effectiveStartTime.setTime(QTime(0, 0, 0));
}
break;
case 2: // winter term
if ((wt.pedwt_paid & 2) == 0) {
// does not have to be paid, move to next midnight
// better: start of next day (falls kein vorkauf besteht)
effectiveStartTime = effectiveStartTime.addDays(1);
effectiveStartTime.setTime(QTime(0, 0, 0));
}
break;
default:;
}
}
}
// handle prepaid option // handle prepaid option
QDateTime effectiveStartTime(start_parking_time);
int const prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id; int const prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id;
std::optional<ATBPrepaid> prepaidOption = tariff->getPrepaidType(prepaid_option_id); std::optional<ATBPrepaid> prepaidOption = tariff->getPrepaidType(prepaid_option_id);
if (prepaidOption.has_value()) { if (prepaidOption.has_value()) {
@ -846,6 +872,17 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:" << effectiveStartTime.toString(Qt::ISODate); qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:" << effectiveStartTime.toString(Qt::ISODate);
int const carryOver = tariff->getPaymentOptions(paymentOptionIndex).pop_carry_over;
qCritical() << __func__ << ":" << __LINE__ << " carryOver flag" << carryOver;
if (carryOver == 1) {
QTime carryOverStart = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].static_start;
int carryOverDuration = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].duration;
qCritical() << __func__ << ":" << __LINE__ << " carryOverStart" << carryOverStart.toString(Qt::ISODate);
qCritical() << __func__ << ":" << __LINE__ << "carryOverDuration" << carryOverDuration;
// handle carry over // handle carry over
int minutesUntilCarryOver = effectiveStartTime.time().secsTo(carryOverStart) / 60; int minutesUntilCarryOver = effectiveStartTime.time().secsTo(carryOverStart) / 60;
if (netto_parking_time > minutesUntilCarryOver) { if (netto_parking_time > minutesUntilCarryOver) {
@ -878,6 +915,10 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate); qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate);
} }
} }
} else {
qCritical() << __func__ << ":" << __LINE__ << "NO carryOver configured";
end_parking_time = effectiveStartTime.addSecs(netto_parking_time*60);
}
end_parking_time.setTime(QTime(end_parking_time.time().hour(), end_parking_time.setTime(QTime(end_parking_time.time().hour(),
end_parking_time.time().minute(), 0)); end_parking_time.time().minute(), 0));
@ -970,10 +1011,14 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
qCritical() << " start (cs): " << cs; qCritical() << " start (cs): " << cs;
qCritical() << " price: " << price; qCritical() << " price: " << price;
duration = Calculator::GetInstance().GetDurationFromCost(tariff, std::pair<std::string, QDateTime> p_duration
= Calculator::GetInstance().GetDurationFromCost(tariff,
tariff->getPaymentOptions(paymentOptionIndex).pop_payment_method_id, tariff->getPaymentOptions(paymentOptionIndex).pop_payment_method_id,
cs.toLocal8Bit().constData(), cs.toLocal8Bit().constData(),
price, permitType, nextDay, prepaid).c_str(); price, permitType, nextDay, prepaid);
duration = p_duration.first.c_str();
QDateTime d = QDateTime::fromString(duration, Qt::ISODate); QDateTime d = QDateTime::fromString(duration, Qt::ISODate);
if (!d.isValid()) { if (!d.isValid()) {
calcState.setDesc(QString("ticketEndTime=%1").arg(duration)); calcState.setDesc(QString("ticketEndTime=%1").arg(duration));
@ -1044,11 +1089,16 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
} }
QString cs = start_parking_time.toString(Qt::ISODate); QString cs = start_parking_time.toString(Qt::ISODate);
QString endTime = Calculator::GetInstance().GetDurationFromCost(
std::pair<std::string, QDateTime> p_endTime
= Calculator::GetInstance().GetDurationFromCost(
tariff, tariff,
tariff->getPaymentOptions().pop_payment_method_id, tariff->getPaymentOptions().pop_payment_method_id,
cs.toLocal8Bit().constData(), cs.toLocal8Bit().constData(),
price, permitType, nextDay, prepaid).c_str(); price, permitType, nextDay, prepaid);
QString endTime = p_endTime.first.c_str();
ticketEndTime = p_endTime.second;
if (endTime == CalcState::SUCCESS) { if (endTime == CalcState::SUCCESS) {
calcState.setDesc(QString("SUCCESS")); calcState.setDesc(QString("SUCCESS"));

View File

@ -118,7 +118,8 @@ QDateTime Calculator::GetDailyTicketDuration(Configuration* cfg, const QDateTime
return QDateTime(); return QDateTime();
} }
/// <inheritdoc/> /// <inheritdoc/>
std::string Calculator::GetDurationFromCost(Configuration* cfg, std::pair<std::string, QDateTime>
Calculator::GetDurationFromCost(Configuration* cfg,
uint8_t payment_option, uint8_t payment_option,
char const *startDatetimePassed, // given in local time char const *startDatetimePassed, // given in local time
double cost, double cost,
@ -134,6 +135,8 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
inputDate.setTime(QTime(inputDate.time().hour(), inputDate.time().minute(), 0)); inputDate.setTime(QTime(inputDate.time().hour(), inputDate.time().minute(), 0));
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg); static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
bool overPaid = false;
int paymentOptionIndex = getPaymentOptionIndex(*cfg, inputDate); int paymentOptionIndex = getPaymentOptionIndex(*cfg, inputDate);
if (paymentOptionIndex == -1) { if (paymentOptionIndex == -1) {
paymentOptionIndex = cfg->getPaymentOptionIndex(QDateTime::fromString(startDatetimePassed, Qt::ISODate)); paymentOptionIndex = cfg->getPaymentOptionIndex(QDateTime::fromString(startDatetimePassed, Qt::ISODate));
@ -162,7 +165,7 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
// minimal price is set by GetTimeSteps() // minimal price is set by GetTimeSteps()
qCritical() << DBG_HEADER << " provided price (cost):" << cost; qCritical() << DBG_HEADER << " provided price (cost):" << cost;
qCritical() << DBG_HEADER << "configured minimal price:" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_price; qCritical() << DBG_HEADER << "configured minimal price:" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_price;
return CalcState::BELOW_MIN_PARKING_PRICE.toStdString(); return std::make_pair(CalcState::BELOW_MIN_PARKING_PRICE.toStdString(), QDateTime());
} }
if (prepaid == false) { if (prepaid == false) {
@ -225,9 +228,9 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
qCritical() << DBG_HEADER << " minimal parking time (minutes):" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_time; qCritical() << DBG_HEADER << " minimal parking time (minutes):" << cfg->getPaymentOptions(paymentOptionIndex).pop_min_time;
if (duration_previous < cfg->getPaymentOptions(paymentOptionIndex).pop_min_time) { if (duration_previous < cfg->getPaymentOptions(paymentOptionIndex).pop_min_time) {
return CalcState::BELOW_MIN_PARKING_TIME.toStdString(); // minimal parking time is set by GetTimeSteps() return std::make_pair(CalcState::BELOW_MIN_PARKING_TIME.toStdString(), d); // minimal parking time is set by GetTimeSteps()
} }
return d.toString(Qt::ISODate).toStdString(); return std::make_pair(d.toString(Qt::ISODate).toStdString(), d);
} }
} }
@ -240,7 +243,7 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
qCritical() << DBG_HEADER << " provided price (cost):" << cost; qCritical() << DBG_HEADER << " provided price (cost):" << cost;
qCritical() << DBG_HEADER << " duration for price:" << durationStr; qCritical() << DBG_HEADER << " duration for price:" << durationStr;
return durationStr.toStdString(); return std::make_pair(durationStr.toStdString(), d);
} }
} }
} }
@ -254,14 +257,14 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
// use tariff with structure as for instance Schoenau, Koenigsee: // use tariff with structure as for instance Schoenau, Koenigsee:
// without given YearPeriod, SpecialDays and SpecialDaysWorktime // without given YearPeriod, SpecialDays and SpecialDaysWorktime
inputDate = inputDate.addSecs(GetDurationForPrice(cfg, cost) * 60); inputDate = inputDate.addSecs(GetDurationForPrice(cfg, cost) * 60);
return inputDate.toString(Qt::ISODate).toStdString(); return std::make_pair(inputDate.toString(Qt::ISODate).toStdString(), inputDate);
} else { } else {
if (Utilities::IsYearPeriodActive(cfg, inputDate)) { if (Utilities::IsYearPeriodActive(cfg, inputDate)) {
if (!prepaid) { if (!prepaid) {
CalcState cs = isParkingAllowed(cfg, inputDate); CalcState cs = isParkingAllowed(cfg, inputDate);
if (cs) { if (cs) {
inputDate.setTime(cs.getAllowedTimeRange().getTimeUntil()); inputDate.setTime(cs.getAllowedTimeRange().getTimeUntil());
return inputDate.toString(Qt::ISODate).toStdString(); return std::make_pair(inputDate.toString(Qt::ISODate).toStdString(), inputDate);
} }
} }
@ -273,15 +276,16 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
if (cost > pop_max_price) { if (cost > pop_max_price) {
qCritical() << DBG_HEADER << "MAX-PARKING-PRICE" << pop_max_price << ", COST" << cost; qCritical() << DBG_HEADER << "MAX-PARKING-PRICE" << pop_max_price << ", COST" << cost;
if (pop_allow_overpay == false) { if (pop_allow_overpay == false) {
return CalcState::OVERPAID.toStdString(); return std::make_pair(CalcState::OVERPAID.toStdString(), QDateTime());
} }
cost = pop_max_price; cost = pop_max_price;
overPaid = true;
// return CalcState::OVERPAID.toStdString(); // return CalcState::OVERPAID.toStdString();
} }
if (cost < pop_min_price) { if (cost < pop_min_price) {
qCritical() << DBG_HEADER << "MIN-PARKING-PRICE" << pop_min_price << ", COST" << cost; qCritical() << DBG_HEADER << "MIN-PARKING-PRICE" << pop_min_price << ", COST" << cost;
return CalcState::BELOW_MIN_PARKING_PRICE.toStdString(); return std::make_pair(CalcState::BELOW_MIN_PARKING_PRICE.toStdString(), QDateTime());
} }
// int const pop_pre_paid = 1; // int const pop_pre_paid = 1;
@ -366,7 +370,7 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
qCritical() << DBG_HEADER qCritical() << DBG_HEADER
<< "ERROR" << inputDate.toString(Qt::ISODate) << "ERROR" << inputDate.toString(Qt::ISODate)
<< "NOT IN VALID WORKING TIME-RANGE"; << "NOT IN VALID WORKING TIME-RANGE";
return ""; return std::make_pair("", QDateTime());
} }
//qCritical() << __func__ << __LINE__; //qCritical() << __func__ << __LINE__;
@ -391,7 +395,7 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
qCritical() << DBG_HEADER qCritical() << DBG_HEADER
<< "ERROR" << inputDate.toString(Qt::ISODate) << "ERROR" << inputDate.toString(Qt::ISODate)
<< "NOT IN VALID WORKING TIME-RANGE"; << "NOT IN VALID WORKING TIME-RANGE";
return ""; return std::make_pair("", QDateTime());
} }
#if DEBUG_GET_DURATION_FROM_COST==1 #if DEBUG_GET_DURATION_FROM_COST==1
@ -440,7 +444,10 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
QDateTime d(QDateTime::fromString(s, Qt::ISODate)); QDateTime d(QDateTime::fromString(s, Qt::ISODate));
d = d.addSecs(duration_previous * 60); d = d.addSecs(duration_previous * 60);
//qCritical() << DBG_HEADER << "XXXXXXXXXXXXXXXXXXXXX" << d; //qCritical() << DBG_HEADER << "XXXXXXXXXXXXXXXXXXXXX" << d;
return d.toString(Qt::ISODate).toStdString(); if (overPaid) {
return std::make_pair(CalcState::OVERPAID.toStdString(), d);
}
return std::make_pair(d.toString(Qt::ISODate).toStdString(), d);
} }
} else { } else {
durationInSecs = cfg->Duration.find(durationId)->second.pun_duration * 60; durationInSecs = cfg->Duration.find(durationId)->second.pun_duration * 60;
@ -551,7 +558,10 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
qCritical() << DBG_HEADER << "TICKET-END" << s; qCritical() << DBG_HEADER << "TICKET-END" << s;
#endif #endif
return s.toStdString(); if (overPaid) {
return std::make_pair(CalcState::OVERPAID.toStdString(), inputDate);
}
return std::make_pair(s.toStdString(), inputDate);
} // if ((double)price == cost) { } // if ((double)price == cost) {
else { else {
//qCritical() << DBG_HEADER; //qCritical() << DBG_HEADER;
@ -561,7 +571,7 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
} }
} }
return ""; return std::make_pair("", QDateTime());
} }
} }
} else } else
@ -578,7 +588,7 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
if (cost < minParkingPrice) { if (cost < minParkingPrice) {
qCritical() << QString("ERROR: COST < MIN_PARKING_PRICE (%1 < %2)").arg(cost).arg(minParkingPrice); qCritical() << QString("ERROR: COST < MIN_PARKING_PRICE (%1 < %2)").arg(cost).arg(minParkingPrice);
return QDateTime().toString(Qt::ISODate).toStdString(); return std::make_pair(QDateTime().toString(Qt::ISODate).toStdString(), QDateTime());
} }
if (cost > maxParkingPrice) { if (cost > maxParkingPrice) {
@ -617,7 +627,7 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
weekdayId = current.date().dayOfWeek(); weekdayId = current.date().dayOfWeek();
if (weekdayId == weekdayIdLast) { if (weekdayId == weekdayIdLast) {
qCritical() << "ERROR: NO VALID WORKDAY-TIMES DEFINED"; qCritical() << "ERROR: NO VALID WORKDAY-TIMES DEFINED";
return QDateTime().toString(Qt::ISODate).toStdString(); return std::make_pair(QDateTime().toString(Qt::ISODate).toStdString(), QDateTime());
} }
} }
@ -635,7 +645,10 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
if (current.time() >= to) { if (current.time() >= to) {
if (carryOverNotSet) { if (carryOverNotSet) {
return end_datetime.toString(Qt::ISODate).toStdString(); if (overPaid) {
return std::make_pair(CalcState::OVERPAID.toStdString(), end_datetime);
}
return std::make_pair(end_datetime.toString(Qt::ISODate).toStdString(), end_datetime);
} else { } else {
QDateTime const dt = start; QDateTime const dt = start;
start = start.addDays(1); start = start.addDays(1);
@ -682,7 +695,10 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
<< "price" << price; << "price" << price;
#endif #endif
end_datetime = current; end_datetime = current;
return end_datetime.toString(Qt::ISODate).toStdString(); if (overPaid) {
return std::make_pair(CalcState::OVERPAID.toStdString(), end_datetime);
}
return std::make_pair(end_datetime.toString(Qt::ISODate).toStdString(), end_datetime);
} }
QTime const &from = QTime::fromString(weekDayWorkTimeRanges[weekDayWorkTimeIndex].pwd_time_from.c_str(), Qt::ISODate); QTime const &from = QTime::fromString(weekDayWorkTimeRanges[weekDayWorkTimeIndex].pwd_time_from.c_str(), Qt::ISODate);
@ -777,7 +793,10 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
<< "end_datetime" << end_datetime.toString(Qt::ISODate) << "end_datetime" << end_datetime.toString(Qt::ISODate)
<< "price" << price; << "price" << price;
#endif #endif
return end_datetime.toString(Qt::ISODate).toStdString(); if (overPaid) {
return std::make_pair(CalcState::OVERPAID.toStdString(), end_datetime);
}
return std::make_pair(end_datetime.toString(Qt::ISODate).toStdString(), end_datetime);
} }
} }
@ -818,7 +837,10 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
<< "end_datetime" << end_datetime.toString(Qt::ISODate) << "end_datetime" << end_datetime.toString(Qt::ISODate)
<< "price" << price; << "price" << price;
#endif #endif
return end_datetime.toString(Qt::ISODate).toStdString(); if (overPaid) {
return std::make_pair(CalcState::OVERPAID.toStdString(), end_datetime);
}
return std::make_pair(end_datetime.toString(Qt::ISODate).toStdString(), end_datetime);
} }
// price has been updated; use next time range // price has been updated; use next time range
@ -849,7 +871,10 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
<< "price" << price; << "price" << price;
#endif #endif
return end_datetime.toString(Qt::ISODate).toStdString(); if (overPaid) {
return std::make_pair(CalcState::OVERPAID.toStdString(), end_datetime);
}
return std::make_pair(end_datetime.toString(Qt::ISODate).toStdString(), end_datetime);
} }
if (moveToNextTimeRange) { if (moveToNextTimeRange) {
@ -965,8 +990,10 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
<< "end_datetime" << end_datetime.toString(Qt::ISODate) << "end_datetime" << end_datetime.toString(Qt::ISODate)
<< "price" << price; << "price" << price;
#endif #endif
if (overPaid) {
return end_datetime.toString(Qt::ISODate).toStdString(); return std::make_pair(CalcState::OVERPAID.toStdString(), end_datetime);
}
return std::make_pair(end_datetime.toString(Qt::ISODate).toStdString(), end_datetime);
} }
} }
@ -979,7 +1006,10 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
<< "final price" << std::max(price, minParkingPrice); << "final price" << std::max(price, minParkingPrice);
#endif #endif
return end_datetime.toString(Qt::ISODate).toStdString(); if (overPaid) {
return std::make_pair(CalcState::OVERPAID.toStdString(), end_datetime);
}
return std::make_pair(end_datetime.toString(Qt::ISODate).toStdString(), end_datetime);
} // while (timeRangeIt != cfg->TimeRange.cend()) { } // while (timeRangeIt != cfg->TimeRange.cend()) {
} }
@ -988,7 +1018,7 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
<< "INVALID END TIME"; << "INVALID END TIME";
#endif #endif
end_datetime = QDateTime(); end_datetime = QDateTime();
return end_datetime.toString(Qt::ISODate).toStdString(); return std::make_pair(end_datetime.toString(Qt::ISODate).toStdString(), end_datetime);
} }
Ticket t = private_GetDurationFromCost(cfg, inputDate, cost, prepaid); Ticket t = private_GetDurationFromCost(cfg, inputDate, cost, prepaid);
@ -996,7 +1026,7 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
// qCritical().noquote() << t; // qCritical().noquote() << t;
// TODO: im fehlerfall // TODO: im fehlerfall
return t.getValidUntil().toString(Qt::ISODate).toStdString(); return std::make_pair(t.getValidUntil().toString(Qt::ISODate).toStdString(), t.getValidUntil());
} }
#undef _DEBUG_ #undef _DEBUG_

View File

@ -1110,6 +1110,7 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
else if (strcmp(inner_obj_name, "pedwt_time_from") == 0) SpecialDaysWorktime.pedwt_time_from = k->value.GetString(); else if (strcmp(inner_obj_name, "pedwt_time_from") == 0) SpecialDaysWorktime.pedwt_time_from = k->value.GetString();
else if (strcmp(inner_obj_name, "pedwt_time_to") == 0) SpecialDaysWorktime.pedwt_time_to = k->value.GetString(); else if (strcmp(inner_obj_name, "pedwt_time_to") == 0) SpecialDaysWorktime.pedwt_time_to = k->value.GetString();
else if (strcmp(inner_obj_name, "pedwt_price") == 0) SpecialDaysWorktime.pedwt_price = k->value.GetDouble(); else if (strcmp(inner_obj_name, "pedwt_price") == 0) SpecialDaysWorktime.pedwt_price = k->value.GetDouble();
else if (strcmp(inner_obj_name, "pedwt_paid") == 0) SpecialDaysWorktime.pedwt_paid = k->value.GetInt();
break; break;
/*case MemberType::WeekDaysType: /*case MemberType::WeekDaysType:
if (strcmp(inner_obj_name, "pdiw_id") == 0) WeekDays.pdiw_id = k->value.GetInt(); if (strcmp(inner_obj_name, "pdiw_id") == 0) WeekDays.pdiw_id = k->value.GetInt();