From 2c2fd3845b67a0decc8329b85d32706306a9ce29 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Tue, 13 Aug 2024 14:35:08 +0200 Subject: [PATCH] Added: int computeBruttoDurationInSecs() and computeBruttoDateTime() based on it. Given a netto duration (in seconds), compute a corresponding brutto duration. --- library/include/mobilisis/calculator_functions.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/library/include/mobilisis/calculator_functions.h b/library/include/mobilisis/calculator_functions.h index 1d3b359..1c85be2 100644 --- a/library/include/mobilisis/calculator_functions.h +++ b/library/include/mobilisis/calculator_functions.h @@ -27,6 +27,13 @@ class Calculator { int netto_parking_time, int paymentOptionIndex); + int computeBruttoDurationInSecs(Configuration const *cfg, + QDateTime const &from, + int durationInSecs, bool maxBrutto = false); + + QDateTime computeBruttoDateTime(Configuration const *cfg, + QDateTime const &from, + int durationInSecs, bool maxBrutto = false); protected: explicit Calculator() = default; @@ -70,8 +77,7 @@ public: /// Date/time of payment to be conducted in ISO8601 format (e.g. 2022-12-25T08:00:00Z) /// /// Returns duration in seconds (data type: double) - std::string GetDurationFromCost(Configuration* cfg, uint8_t vehicle_type, char const* start_datetime, double price, - PermitType permitType, bool nextDay = false, bool prepaid = false); + std::string GetDurationFromCost(Configuration* cfg, uint8_t vehicle_type, char const* start_datetime, double price, PermitType permitType, bool nextDay = false, bool prepaid = false); /// /// Gets cost from duration in seconds @@ -79,11 +85,10 @@ public: /// Pointer to configuration /// Type of vehicle /// Date/time of payment to be conducted in ISO8601 format (e.g. 2022-12-25T08:00:00Z) - /// Date/time of park end to be conducted in ISO8601 format (e.g. 2022-12-25T08:00:00Z) + /// Date/time of park end to be conducted in ISO8601 format (e.g. 2022-12-25T08:00:00Z) /// Duration of parking in minutes /// Returns cost (data type: double) - double GetCostFromDuration(Configuration* cfg, uint8_t vehicle_type, QDateTime &start_datetime, QDateTime & end_datetime, int durationMin, - PermitType permitType, bool nextDay = false, bool prepaid = false); + double GetCostFromDuration(Configuration* cfg, uint8_t vehicle_type, QDateTime &start_datetime, QDateTime & end_datetime, int durationMin, PermitType permitType, bool nextDay = false, bool prepaid = false); // Daily ticket QDateTime GetDailyTicketDuration(Configuration* cfg, const QDateTime start_datetime, uint8_t payment_option, bool carry_over);