Compare commits
No commits in common. "f87399ed448f11595034c4b8d6a5e39ade006572" and "f46adac56d738c5344660c55e1501545b8aea231" have entirely different histories.
f87399ed44
...
f46adac56d
@ -57,8 +57,7 @@ struct CALCULATE_LIBRARY_API CalcState {
|
||||
ABOVE_MAX_PARKING_TIME,
|
||||
BELOW_MIN_PARKING_TIME,
|
||||
BELOW_MIN_PARKING_PRICE,
|
||||
OVERPAID,
|
||||
OUTSIDE_ALLOWED_PARKING_TIME
|
||||
OVERPAID
|
||||
};
|
||||
|
||||
State m_status;
|
||||
@ -108,8 +107,6 @@ struct CALCULATE_LIBRARY_API CalcState {
|
||||
break;
|
||||
case State::WRONG_ISO_TIME_FORMAT:
|
||||
s = "WRONG_ISO_TIME_FORMAT";
|
||||
case State::OUTSIDE_ALLOWED_PARKING_TIME:
|
||||
s = "OUTSIDE_ALLOWED_PARKING_TIME";
|
||||
}
|
||||
return s + ":" + m_desc;
|
||||
}
|
||||
|
@ -712,9 +712,9 @@ QList<int> Calculator::GetTimeSteps(Configuration *cfg) const {
|
||||
int const pop_carry_over = cfg->getPaymentOptions().pop_carry_over;
|
||||
int const pop_time_step_config = cfg->getPaymentOptions().pop_time_step_config;
|
||||
|
||||
qCritical() << __func__ << ":" << __LINE__ << " start parking time:" << start.toString(Qt::ISODate);
|
||||
qCritical() << __func__ << ":" << __LINE__ << " payment option id:" << pop_id;
|
||||
qCritical() << __func__ << ":" << __LINE__ << "payment option carry over:" << pop_carry_over;
|
||||
qCritical() << __PRETTY_FUNCTION__ << " start parking time:" << start.toString(Qt::ISODate);
|
||||
qCritical() << __PRETTY_FUNCTION__ << " payment option id:" << pop_id;
|
||||
qCritical() << __PRETTY_FUNCTION__ << " payment option carry over:" << pop_carry_over;
|
||||
|
||||
if (pop_time_step_config == (int)ATBTimeStepConfig::TimeStepConfig::DYNAMIC) {
|
||||
//qCritical() << __PRETTY_FUNCTION__ << "payment option time step config:" << "TimeStepConfig::DYNAMIC";
|
||||
@ -852,9 +852,11 @@ Calculator::GetDailyTicketPrice(Configuration* cfg,
|
||||
ATBWeekDaysWorktime const &wt = workTime.value();
|
||||
endTime = startDatetime;
|
||||
endTime.setTime(QTime::fromString(wt.pwd_time_to.c_str(), Qt::ISODate));
|
||||
|
||||
std::optional<QVector<ATBDailyTicket>> dailyTickets = cfg->getDailyTicketsForAllKeys();
|
||||
if (dailyTickets) {
|
||||
QVector<ATBDailyTicket> const tickets = dailyTickets.value();
|
||||
|
||||
switch (permitType) {
|
||||
case PERMIT_TYPE::DAY_TICKET_ADULT: {
|
||||
std::optional<ATBCustomer> c = cfg->getCustomerForType(ATBCustomer::CustomerType::ADULT);
|
||||
@ -862,20 +864,12 @@ Calculator::GetDailyTicketPrice(Configuration* cfg,
|
||||
for (QVector<ATBDailyTicket>::size_type i=0; i<tickets.size(); ++i) {
|
||||
if (tickets[i].daily_ticket_clearance_customer_ids.contains(c.value().cust_id)) {
|
||||
int priceId = tickets[i].daily_ticket_price_id;
|
||||
QVector<ATBPaymentOption> const &paymentOptions = cfg->getAllPaymentOptions();
|
||||
for (QVector<ATBPaymentOption>::size_type j=0; j < paymentOptions.size(); ++j) {
|
||||
int const pop_id = paymentOptions.at(j).pop_id;
|
||||
std::optional<QVector<ATBPaymentRate>> const &paymentRates = cfg->getPaymentRateForKey(pop_id);
|
||||
if (paymentRates) {
|
||||
QVector<ATBPaymentRate> const &pr = paymentRates.value();
|
||||
for (QVector<ATBPaymentRate>::size_type k=0; k < pr.size(); ++k) {
|
||||
if (pr.at(k).pra_payment_option_id == pop_id) {
|
||||
if (priceId == pr.at(k).pra_payment_unit_id) {
|
||||
price.netto = pr.at(k).pra_price;
|
||||
value = value.value_or(price);
|
||||
}
|
||||
}
|
||||
}
|
||||
std::optional<QVector<ATBPaymentRate>> const &paymentRates = cfg->getPaymentRateForKey(priceId);
|
||||
if (paymentRates) {
|
||||
QVector<ATBPaymentRate> const &pr = paymentRates.value();
|
||||
if (pr.size() > 0) {
|
||||
price.netto = pr.at(0).pra_price;
|
||||
value.value_or(price);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -888,20 +882,12 @@ Calculator::GetDailyTicketPrice(Configuration* cfg,
|
||||
for (QVector<ATBDailyTicket>::size_type i=0; i<tickets.size(); ++i) {
|
||||
if (tickets[i].daily_ticket_clearance_customer_ids.contains(c.value().cust_id)) {
|
||||
int priceId = tickets[i].daily_ticket_price_id;
|
||||
QVector<ATBPaymentOption> const &paymentOptions = cfg->getAllPaymentOptions();
|
||||
for (QVector<ATBPaymentOption>::size_type j=0; j < paymentOptions.size(); ++j) {
|
||||
int const pop_id = paymentOptions.at(j).pop_id;
|
||||
std::optional<QVector<ATBPaymentRate>> const &paymentRates = cfg->getPaymentRateForKey(pop_id);
|
||||
if (paymentRates) {
|
||||
QVector<ATBPaymentRate> const &pr = paymentRates.value();
|
||||
for (QVector<ATBPaymentRate>::size_type k=0; k < pr.size(); ++k) {
|
||||
if (pr.at(k).pra_payment_option_id == pop_id) {
|
||||
if (priceId == pr.at(k).pra_payment_unit_id) {
|
||||
price.netto = pr.at(k).pra_price;
|
||||
value = value.value_or(price);
|
||||
}
|
||||
}
|
||||
}
|
||||
std::optional<QVector<ATBPaymentRate>> const &paymentRates = cfg->getPaymentRateForKey(priceId);
|
||||
if (paymentRates) {
|
||||
QVector<ATBPaymentRate> const &pr = paymentRates.value();
|
||||
if (pr.size() > 0) {
|
||||
price.netto = pr.at(0).pra_price;
|
||||
value.value_or(price);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -909,30 +895,6 @@ Calculator::GetDailyTicketPrice(Configuration* cfg,
|
||||
}
|
||||
} break;
|
||||
case PERMIT_TYPE::DAY_TICKET_CHILD: {
|
||||
std::optional<ATBCustomer> c = cfg->getCustomerForType(ATBCustomer::CustomerType::CHILD);
|
||||
if (c) {
|
||||
for (QVector<ATBDailyTicket>::size_type i=0; i<tickets.size(); ++i) {
|
||||
if (tickets[i].daily_ticket_clearance_customer_ids.contains(c.value().cust_id)) {
|
||||
int priceId = tickets[i].daily_ticket_price_id;
|
||||
QVector<ATBPaymentOption> const &paymentOptions = cfg->getAllPaymentOptions();
|
||||
for (QVector<ATBPaymentOption>::size_type j=0; j < paymentOptions.size(); ++j) {
|
||||
int const pop_id = paymentOptions.at(j).pop_id;
|
||||
std::optional<QVector<ATBPaymentRate>> const &paymentRates = cfg->getPaymentRateForKey(pop_id);
|
||||
if (paymentRates) {
|
||||
QVector<ATBPaymentRate> const &pr = paymentRates.value();
|
||||
for (QVector<ATBPaymentRate>::size_type k=0; k < pr.size(); ++k) {
|
||||
if (pr.at(k).pra_payment_option_id == pop_id) {
|
||||
if (priceId == pr.at(k).pra_payment_unit_id) {
|
||||
price.netto = pr.at(k).pra_price;
|
||||
value = value.value_or(price);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// [[fallthrough]];
|
||||
case PERMIT_TYPE::SHORT_TERM_PARKING: {
|
||||
|
@ -579,11 +579,9 @@ Configuration::getWeekDayWorkTime(QTime const &time, Qt::DayOfWeek dayOfWeek) {
|
||||
|
||||
std::multimap<int, ATBWeekDaysWorktime>::const_iterator it = this->WeekDaysWorktime.find((int)dayOfWeek);
|
||||
if (it != this->WeekDaysWorktime.cend()) {
|
||||
|
||||
ATBWeekDaysWorktime const &wt = it->second;
|
||||
|
||||
if (time >= QTime::fromString(wt.pwd_time_from.c_str(), Qt::ISODate)
|
||||
&& time < QTime::fromString(wt.pwd_time_to.c_str(), Qt::ISODate)) {
|
||||
if (QTime::fromString(wt.pwd_time_from.c_str(), Qt::ISODate) >= time
|
||||
&& QTime::fromString(wt.pwd_time_to.c_str(), Qt::ISODate) < time) {
|
||||
value = value.value_or(wt);
|
||||
}
|
||||
}
|
||||
|
@ -33,11 +33,11 @@ extern "C" char* strptime(const char* s,
|
||||
#include "calculator_functions.h"
|
||||
#include "calculate_price.h"
|
||||
|
||||
#define SZEGED (0)
|
||||
#define SZEGED (1)
|
||||
#define SCHOENAU_KOENIGSEE (0)
|
||||
#define NEUHAUSER_KORNEUBURG (0)
|
||||
#define NEUHAUSER_LINSINGER_MASCHINENBAU (0)
|
||||
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (1)
|
||||
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0)
|
||||
#define NEUHAUSER_BILEXA_GALTUER (0)
|
||||
|
||||
|
||||
@ -133,24 +133,6 @@ int main() {
|
||||
cout << endl;
|
||||
|
||||
if (isParsed) {
|
||||
QDateTime s(QDate(2023, 11, 30), QTime());
|
||||
QDateTime end;
|
||||
struct price_t price;
|
||||
memset(&price, 0, sizeof(struct price_t));
|
||||
for (int offset = 480; offset < 1080; ++offset) {
|
||||
QDateTime start = s.addSecs(offset * 60);
|
||||
CalcState cs = compute_price_for_daily_ticket(&cfg, start, end,
|
||||
PERMIT_TYPE::DAY_TICKET_ADULT, &price);
|
||||
qCritical() << "start=" << start.toString(Qt::ISODate)
|
||||
<< "end" << end.toString(Qt::ISODate) << "price" << price.netto;
|
||||
}
|
||||
for (int offset = 480; offset < 1080; ++offset) {
|
||||
QDateTime start = s.addSecs(offset * 60);
|
||||
CalcState cs = compute_price_for_daily_ticket(&cfg, start, end,
|
||||
PERMIT_TYPE::DAY_TICKET_TEEN, &price);
|
||||
qCritical() << "start=" << start.toString(Qt::ISODate)
|
||||
<< "end" << end.toString(Qt::ISODate) << "price" << price.netto;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user