Compare commits
No commits in common. "7f25c46d306f78f677ee98211b5df5582102113e" and "abf4ef0b0096ed664efbf221dd4a1719a90a462c" have entirely different histories.
7f25c46d30
...
abf4ef0b00
@ -9,7 +9,6 @@ public:
|
|||||||
: pun_id(0)
|
: pun_id(0)
|
||||||
, pun_label("")
|
, pun_label("")
|
||||||
, pun_duration(0)
|
, pun_duration(0)
|
||||||
, pun_duration_saved(0)
|
|
||||||
, pun_duration_min(0)
|
, pun_duration_min(0)
|
||||||
, pun_duration_max(0)
|
, pun_duration_max(0)
|
||||||
, pun_interpolation_id(-1) {
|
, pun_interpolation_id(-1) {
|
||||||
@ -22,7 +21,6 @@ public:
|
|||||||
<< " pun_id: " << td.pun_id << "\n"
|
<< " pun_id: " << td.pun_id << "\n"
|
||||||
<< " pun_label: " << QString::fromStdString(td.pun_label) << "\n"
|
<< " pun_label: " << QString::fromStdString(td.pun_label) << "\n"
|
||||||
<< " pun_duration: " << td.pun_duration << "\n"
|
<< " pun_duration: " << td.pun_duration << "\n"
|
||||||
<< " pun_duration_saved: " << td.pun_duration_saved << "\n"
|
|
||||||
<< " pun_duration_min: " << td.pun_duration_min << "\n"
|
<< " pun_duration_min: " << td.pun_duration_min << "\n"
|
||||||
<< " pun_duration_max: " << td.pun_duration_max << "\n"
|
<< " pun_duration_max: " << td.pun_duration_max << "\n"
|
||||||
<< "pun_interpolation_id: " << td.pun_interpolation_id << "\n";
|
<< "pun_interpolation_id: " << td.pun_interpolation_id << "\n";
|
||||||
@ -33,7 +31,6 @@ public:
|
|||||||
int pun_id;
|
int pun_id;
|
||||||
std::string pun_label;
|
std::string pun_label;
|
||||||
int pun_duration;
|
int pun_duration;
|
||||||
int pun_duration_saved;
|
|
||||||
int pun_duration_min;
|
int pun_duration_min;
|
||||||
int pun_duration_max;
|
int pun_duration_max;
|
||||||
int pun_interpolation_id;
|
int pun_interpolation_id;
|
||||||
|
@ -410,14 +410,12 @@ int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int cu
|
|||||||
maxStep = stepList[1] - stepList[0];
|
maxStep = stepList[1] - stepList[0];
|
||||||
}
|
}
|
||||||
int tolerance = (maxStep == -1) ? 5 : std::min(maxStep, 5);
|
int tolerance = (maxStep == -1) ? 5 : std::min(maxStep, 5);
|
||||||
for (int i=0; i < stepList.size(); ++i) {
|
if (std::abs(stepList[0] - currentTimeMinutes) <= tolerance) {
|
||||||
if (std::abs(stepList[i] - currentTimeMinutes) <= tolerance) {
|
qCritical().noquote()
|
||||||
qCritical().noquote()
|
<< QString(" compute_next_timestep() correction stepList[0]=%1 -> %2:")
|
||||||
<< QString(" compute_next_timestep() correction stepList[%1]=%2 -> %3:")
|
.arg(stepList[0]).arg(currentTimeMinutes);
|
||||||
.arg(i).arg(stepList[0]).arg(currentTimeMinutes);
|
stepList[0] = currentTimeMinutes;
|
||||||
stepList[i] = currentTimeMinutes;
|
qCritical() << " compute_next_timestep() NEW timeSteps:" << stepList;
|
||||||
qCritical() << " compute_next_timestep() NEW timeSteps:" << stepList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int currentStepIndex = stepList.indexOf(currentTimeMinutes);
|
int currentStepIndex = stepList.indexOf(currentTimeMinutes);
|
||||||
|
@ -2123,14 +2123,9 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_timeSteps.size() > paymentOptionIndex) {
|
if (m_timeSteps.size() > paymentOptionIndex) {
|
||||||
|
if (!m_timeSteps[paymentOptionIndex].isEmpty()) {
|
||||||
//if (!m_timeSteps[paymentOptionIndex].isEmpty()) {
|
return m_timeSteps[paymentOptionIndex];
|
||||||
// return m_timeSteps[paymentOptionIndex];
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
// recompute time steps
|
|
||||||
m_timeSteps[paymentOptionIndex].clear();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
m_timeSteps.push_back(QList<int>());
|
m_timeSteps.push_back(QList<int>());
|
||||||
}
|
}
|
||||||
@ -2257,7 +2252,6 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO";
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO";
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: check if needed
|
|
||||||
QDateTime interpolationEnd;
|
QDateTime interpolationEnd;
|
||||||
std::optional<QDateTime> interpolationEndDate = cfg->getInterpolationEnd(start, paymentOptionIndex);
|
std::optional<QDateTime> interpolationEndDate = cfg->getInterpolationEnd(start, paymentOptionIndex);
|
||||||
if (interpolationEndDate) {
|
if (interpolationEndDate) {
|
||||||
@ -2275,18 +2269,6 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
|
|
||||||
int const pop_truncate_last_interpolation_step = cfg->getPaymentOptions(paymentOptionIndex).pop_truncate_last_interpolation_step;
|
int const pop_truncate_last_interpolation_step = cfg->getPaymentOptions(paymentOptionIndex).pop_truncate_last_interpolation_step;
|
||||||
|
|
||||||
// TODO: auslagern
|
|
||||||
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr) {
|
|
||||||
int const durationId = itr->second.pra_payment_unit_id;
|
|
||||||
|
|
||||||
auto search = cfg->Duration.find(durationId);
|
|
||||||
if (search != cfg->Duration.end()) {
|
|
||||||
ATBDuration duration = search->second;
|
|
||||||
duration.pun_duration = duration.pun_duration_saved;
|
|
||||||
search->second = duration;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr) {
|
for (auto[itr, rangeEnd] = cfg->PaymentRate.equal_range(pop_id); itr != rangeEnd; ++itr) {
|
||||||
int const durationId = itr->second.pra_payment_unit_id;
|
int const durationId = itr->second.pra_payment_unit_id;
|
||||||
// int const price = itr->second.pra_price;
|
// int const price = itr->second.pra_price;
|
||||||
@ -2342,6 +2324,7 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
int rest = nextTimeStep.secsTo(interpolationEnd);
|
int rest = nextTimeStep.secsTo(interpolationEnd);
|
||||||
if (nextTimeStep <= interpolationEnd) {
|
if (nextTimeStep <= interpolationEnd) {
|
||||||
if (rest > 0 && rest < duration.pun_duration) {
|
if (rest > 0 && rest < duration.pun_duration) {
|
||||||
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") TODO TODO:" << rest;
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") rest minutes:" << rest;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") rest minutes:" << rest;
|
||||||
// last time step before switching to dayticket (see Schnals 505/506)
|
// last time step before switching to dayticket (see Schnals 505/506)
|
||||||
//if (duration.pun_duration > 0) {
|
//if (duration.pun_duration > 0) {
|
||||||
@ -2443,8 +2426,6 @@ QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") NEW timeSteps:" << m_timeSteps;
|
|
||||||
|
|
||||||
if (DBG_LEVEL >= DBG_DEBUG) {
|
if (DBG_LEVEL >= DBG_DEBUG) {
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ") NEW timeSteps:" << m_timeSteps;
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ") NEW timeSteps:" << m_timeSteps;
|
||||||
|
|
||||||
|
@ -691,10 +691,8 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
|
|||||||
case MemberType::DurationType:
|
case MemberType::DurationType:
|
||||||
if (strcmp(inner_obj_name, "pun_id") == 0) Duration.pun_id = k->value.GetInt();
|
if (strcmp(inner_obj_name, "pun_id") == 0) Duration.pun_id = k->value.GetInt();
|
||||||
else if (strcmp(inner_obj_name, "pun_label") == 0) Duration.pun_label = k->value.GetString();
|
else if (strcmp(inner_obj_name, "pun_label") == 0) Duration.pun_label = k->value.GetString();
|
||||||
else if (strcmp(inner_obj_name, "pun_duration") == 0) {
|
else if (strcmp(inner_obj_name, "pun_duration") == 0) Duration.pun_duration = k->value.GetDouble();
|
||||||
Duration.pun_duration = k->value.GetDouble();
|
else if (strcmp(inner_obj_name, "pun_duration_min") == 0) Duration.pun_duration_min = k->value.GetInt();
|
||||||
Duration.pun_duration_saved = Duration.pun_duration;
|
|
||||||
} else if (strcmp(inner_obj_name, "pun_duration_min") == 0) Duration.pun_duration_min = k->value.GetInt();
|
|
||||||
else if (strcmp(inner_obj_name, "pun_duration_max") == 0) Duration.pun_duration_max = k->value.GetInt();
|
else if (strcmp(inner_obj_name, "pun_duration_max") == 0) Duration.pun_duration_max = k->value.GetInt();
|
||||||
else if (strcmp(inner_obj_name, "pun_interpolation_id") == 0) Duration.pun_interpolation_id = k->value.GetInt();
|
else if (strcmp(inner_obj_name, "pun_interpolation_id") == 0) Duration.pun_interpolation_id = k->value.GetInt();
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user