Compare commits
	
		
			5 Commits
		
	
	
		
			fuchs-mueh
			...
			fix-galtue
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 861a405ec0 | |||
| 6b88213644 | |||
| dda04434fc | |||
| a7f3477752 | |||
| 8367eb9fa8 | 
@@ -91,7 +91,7 @@ public:
 | 
				
			|||||||
    // helper function to find time steps for a tariff with PaymentMethod::Steps
 | 
					    // helper function to find time steps for a tariff with PaymentMethod::Steps
 | 
				
			||||||
    // (e.g. Schoenau/Koenigsee)
 | 
					    // (e.g. Schoenau/Koenigsee)
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    QList<int> GetTimeSteps(Configuration *cfg, int paymentOptionIndex=0) const;
 | 
					    QList<int> &GetTimeSteps(Configuration *cfg, int paymentOptionIndex=0) const;
 | 
				
			||||||
    QList<int> GetSteps(Configuration *cfg, int paymentOptionIndex=0) const { return GetTimeSteps(cfg, paymentOptionIndex); }
 | 
					    QList<int> GetSteps(Configuration *cfg, int paymentOptionIndex=0) const { return GetTimeSteps(cfg, paymentOptionIndex); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QList<int> GetPriceSteps(Configuration *cfg) const;
 | 
					    QList<int> GetPriceSteps(Configuration *cfg) const;
 | 
				
			||||||
@@ -115,7 +115,7 @@ public:
 | 
				
			|||||||
    uint32_t GetCostFromDuration(Configuration *cfg, QDateTime const &start, quint64 durationMinutes, int paymentOptionIndex=0) const;
 | 
					    uint32_t GetCostFromDuration(Configuration *cfg, QDateTime const &start, quint64 durationMinutes, int paymentOptionIndex=0) const;
 | 
				
			||||||
    uint32_t GetCostFromDuration(Configuration *cfg, QDateTime const &start, QDateTime const &end, int paymentOptionIndex=0) const;
 | 
					    uint32_t GetCostFromDuration(Configuration *cfg, QDateTime const &start, QDateTime const &end, int paymentOptionIndex=0) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					// private:
 | 
				
			||||||
    Ticket private_GetCostFromDuration(Configuration const* cfg,
 | 
					    Ticket private_GetCostFromDuration(Configuration const* cfg,
 | 
				
			||||||
                                       QDateTime const &start,
 | 
					                                       QDateTime const &start,
 | 
				
			||||||
                                       int durationMinutes,
 | 
					                                       int durationMinutes,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,6 +28,10 @@ public:
 | 
				
			|||||||
        pop_carry_over_time_range_id = -1;
 | 
					        pop_carry_over_time_range_id = -1;
 | 
				
			||||||
        pop_carry_over_start_time_range = -1;
 | 
					        pop_carry_over_start_time_range = -1;
 | 
				
			||||||
        pop_carry_over_end_time_range = -1;
 | 
					        pop_carry_over_end_time_range = -1;
 | 
				
			||||||
 | 
					        pop_prepay = false;
 | 
				
			||||||
 | 
					        pop_prepay_time_range_id = -1;
 | 
				
			||||||
 | 
					        pop_prepay_over_start_time_range = -1;
 | 
				
			||||||
 | 
					        pop_prepay_end_time_range = -1;
 | 
				
			||||||
        pop_daily_card_price = -1;
 | 
					        pop_daily_card_price = -1;
 | 
				
			||||||
        pop_business_hours = -1;
 | 
					        pop_business_hours = -1;
 | 
				
			||||||
        pop_time_step_config = -1;
 | 
					        pop_time_step_config = -1;
 | 
				
			||||||
@@ -48,6 +52,10 @@ public:
 | 
				
			|||||||
    int pop_carry_over_time_range_id;
 | 
					    int pop_carry_over_time_range_id;
 | 
				
			||||||
    int pop_carry_over_start_time_range;
 | 
					    int pop_carry_over_start_time_range;
 | 
				
			||||||
    int pop_carry_over_end_time_range;
 | 
					    int pop_carry_over_end_time_range;
 | 
				
			||||||
 | 
					    bool pop_prepay;
 | 
				
			||||||
 | 
					    int pop_prepay_time_range_id;
 | 
				
			||||||
 | 
					    int pop_prepay_over_start_time_range;
 | 
				
			||||||
 | 
					    int pop_prepay_end_time_range;
 | 
				
			||||||
    int pop_daily_card_price;
 | 
					    int pop_daily_card_price;
 | 
				
			||||||
    uint64_t pop_business_hours;
 | 
					    uint64_t pop_business_hours;
 | 
				
			||||||
    int pop_time_step_config;
 | 
					    int pop_time_step_config;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -372,8 +372,31 @@ int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int cu
 | 
				
			|||||||
        // progressive tariff: e.g. Neuhauser, Kirchdorf (743)
 | 
					        // progressive tariff: e.g. Neuhauser, Kirchdorf (743)
 | 
				
			||||||
        (paymentMethodId == PaymentMethod::Progressive))
 | 
					        (paymentMethodId == PaymentMethod::Progressive))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        const QList<int> stepList = Calculator::GetInstance().GetTimeSteps(tariff);
 | 
					        QList<int> &stepList = Calculator::GetInstance().GetTimeSteps(tariff);
 | 
				
			||||||
 | 
					        int const size = stepList.size();
 | 
				
			||||||
 | 
					        if (size == 0) {
 | 
				
			||||||
 | 
					            qCritical() << "compute_next_timestep() *ERROR empty step-list*";
 | 
				
			||||||
 | 
					            return  currentTimeMinutes;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        qCritical() << "   compute_next_timestep()      first time step:" << stepList[0];
 | 
				
			||||||
        qCritical() << "   compute_next_timestep()            timeSteps:" << stepList;
 | 
					        qCritical() << "   compute_next_timestep()            timeSteps:" << stepList;
 | 
				
			||||||
 | 
					        qCritical() << "   compute_next_timestep() currentTimeInMinutes:" << currentTimeMinutes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // consider time shift: the step-list might have been computed at a
 | 
				
			||||||
 | 
					        // slightly different time point
 | 
				
			||||||
 | 
					        int maxStep = -1;
 | 
				
			||||||
 | 
					        if (size >= 2) {
 | 
				
			||||||
 | 
					            maxStep = stepList[1] - stepList[0];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        int tolerance = (maxStep == -1) ? 5 : std::min(maxStep, 5);
 | 
				
			||||||
 | 
					        if (std::abs(stepList[0] - currentTimeMinutes) <= tolerance) {
 | 
				
			||||||
 | 
					            qCritical().noquote()
 | 
				
			||||||
 | 
					                << QString("   compute_next_timestep() correction stepList[0]=%1 -> %2:")
 | 
				
			||||||
 | 
					                                    .arg(stepList[0]).arg(currentTimeMinutes);
 | 
				
			||||||
 | 
					            stepList[0] = currentTimeMinutes;
 | 
				
			||||||
 | 
					            qCritical() << "   compute_next_timestep()        NEW timeSteps:" << stepList;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        int currentStepIndex = stepList.indexOf(currentTimeMinutes);
 | 
					        int currentStepIndex = stepList.indexOf(currentTimeMinutes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2090,12 +2090,13 @@ QList<int> Calculator::GetPriceSteps(Configuration * /*cfg*/) const {
 | 
				
			|||||||
    return QList<int>();
 | 
					    return QList<int>();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QList<int> Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex) const {
 | 
					QList<int> &Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex) const {
 | 
				
			||||||
    qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << "paymentOptionIndex:" << paymentOptionIndex;
 | 
					    qCritical() << "(" << __func__ << ":" << __LINE__ << ")              paymentOptionIndex:" << paymentOptionIndex;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (m_timeSteps.size() > paymentOptionIndex) {
 | 
					    if (m_timeSteps.size() > paymentOptionIndex) {
 | 
				
			||||||
        //qCritical() << __PRETTY_FUNCTION__ << "timeSteps:" << m_timeSteps;
 | 
					        if (!m_timeSteps[paymentOptionIndex].isEmpty()) {
 | 
				
			||||||
            return m_timeSteps[paymentOptionIndex];
 | 
					            return m_timeSteps[paymentOptionIndex];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        m_timeSteps.push_back(QList<int>());
 | 
					        m_timeSteps.push_back(QList<int>());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -2200,7 +2201,7 @@ QList<int> Calculator::GetTimeSteps(Configuration *cfg, int paymentOptionIndex)
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qCritical() << "(" << __func__ << ":" << __LINE__ << ")" << "NEW timeSteps:" << m_timeSteps;
 | 
					    qCritical() << "(" << __func__ << ":" << __LINE__ << ")                   NEW timeSteps:" << m_timeSteps;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return m_timeSteps[paymentOptionIndex];
 | 
					    return m_timeSteps[paymentOptionIndex];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,12 +45,12 @@ extern "C" char* strptime(const char* s,
 | 
				
			|||||||
#define NEUHAUSER_KORNEUBURG                    (0)
 | 
					#define NEUHAUSER_KORNEUBURG                    (0)
 | 
				
			||||||
#define NEUHAUSER_LINSINGER_MASCHINENBAU        (0)
 | 
					#define NEUHAUSER_LINSINGER_MASCHINENBAU        (0)
 | 
				
			||||||
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0)
 | 
					#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0)
 | 
				
			||||||
#define NEUHAUSER_BILEXA_GALTUER                (0)
 | 
					#define NEUHAUSER_BILEXA_GALTUER                (1)
 | 
				
			||||||
#define BAD_NEUENAHR_AHRWEILER                  (0)
 | 
					#define BAD_NEUENAHR_AHRWEILER                  (0)
 | 
				
			||||||
#define NEUHAUSER_CHRISTOPH_REISEN              (0)
 | 
					#define NEUHAUSER_CHRISTOPH_REISEN              (0)
 | 
				
			||||||
#define NEUHAUSER_PERNEGG_AN_DER_MUR            (0)
 | 
					#define NEUHAUSER_PERNEGG_AN_DER_MUR            (0)
 | 
				
			||||||
#define NEUHAUSER_STOCKERAU                     (0)
 | 
					#define NEUHAUSER_STOCKERAU                     (0)
 | 
				
			||||||
#define KLEIPEDA_LITAUEN                        (1)
 | 
					#define KLEIPEDA_LITAUEN                        (0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if NEUHAUSER_KIRCHDORF==1
 | 
					#if NEUHAUSER_KIRCHDORF==1
 | 
				
			||||||
static bool test_neuhauser_kirchdorf(int step, double cost) {
 | 
					static bool test_neuhauser_kirchdorf(int step, double cost) {
 | 
				
			||||||
@@ -924,6 +924,7 @@ void iuc_asynchpos_command_authorize(unsigned int vkPreis) {
 | 
				
			|||||||
    iuc_asynchpos_send(packetType,message,uitemp,0x00);
 | 
					    iuc_asynchpos_send(packetType,message,uitemp,0x00);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main() {
 | 
					int main() {
 | 
				
			||||||
#if 0
 | 
					#if 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -932,7 +933,7 @@ int main() {
 | 
				
			|||||||
    msgHelp.createAuthorizeMessageChunksToSend(0x02);
 | 
					    msgHelp.createAuthorizeMessageChunksToSend(0x02);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qCritical() << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" << endl;
 | 
					    qCritical() << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ssh -i ~/.ssh/id_ed25519_ptu5 root@10.0.15.175<< endl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // unsigned static char terminalID[IUC_ASYNCHPOS_MIN_BASE_DATA_SIZE];
 | 
					    // unsigned static char terminalID[IUC_ASYNCHPOS_MIN_BASE_DATA_SIZE];
 | 
				
			||||||
    // unsigned static char terminalAPAK[IUC_ASYNCHPOS_MIN_BASE_DATA_SIZE];
 | 
					    // unsigned static char terminalAPAK[IUC_ASYNCHPOS_MIN_BASE_DATA_SIZE];
 | 
				
			||||||
@@ -2754,7 +2755,7 @@ int main() {
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if NEUHAUSER_BILEXA_GALTUER==1
 | 
					#if NEUHAUSER_BILEXA_GALTUER==1
 | 
				
			||||||
    std::ifstream input("/opt/ptu5/opt/customer_745/etc/psa_tariff/tariff01.json");
 | 
					    std::ifstream input("/home/linux/customer_745/etc/psa_tariff/tariff01.json");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    std::stringstream sstr;
 | 
					    std::stringstream sstr;
 | 
				
			||||||
    while(input >> sstr.rdbuf());
 | 
					    while(input >> sstr.rdbuf());
 | 
				
			||||||
@@ -2771,7 +2772,14 @@ int main() {
 | 
				
			|||||||
        qCritical() << timeSteps;
 | 
					        qCritical() << timeSteps;
 | 
				
			||||||
        int Down = 0;
 | 
					        int Down = 0;
 | 
				
			||||||
        int Up = 1;
 | 
					        int Up = 1;
 | 
				
			||||||
        //compute_next_timestep(&cfg, )
 | 
					        QDateTime current = QDateTime::currentDateTime();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        int minParkTime = get_minimal_parkingtime(&cfg, PERMIT_TYPE::DAY_TICKET,  0);
 | 
				
			||||||
 | 
					        qCritical() << "minParkTime" << minParkTime;
 | 
				
			||||||
 | 
					        qCritical() << "min_pop_time" << cfg.getPaymentOptions(0).pop_min_time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        int nextStep = compute_next_timestep(&cfg, minParkTime + 1, 1);
 | 
				
			||||||
 | 
					        qCritical() << "nextStep" << nextStep;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        QDateTime const start = QDateTime::currentDateTime();
 | 
					        QDateTime const start = QDateTime::currentDateTime();
 | 
				
			||||||
        int paymentOptionIndex = cfg.getPaymentOptionIndex(start);
 | 
					        int paymentOptionIndex = cfg.getPaymentOptionIndex(start);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user