Added helper getTimeRangeStep() (useful for progressive tariff as for neuhauser/kirchdorf (743)

This commit is contained in:
Gerhard Hoffmann 2024-02-21 09:31:13 +01:00
parent 690267c388
commit e0223b50f9
2 changed files with 9 additions and 0 deletions

View File

@ -90,6 +90,7 @@ namespace Utilities {
uint32_t getMinimalParkingPrice(Configuration const *cfg, PaymentMethod methodId); uint32_t getMinimalParkingPrice(Configuration const *cfg, PaymentMethod methodId);
uint32_t getMaximalParkingPrice(Configuration const *cfg, PaymentMethod methodId); uint32_t getMaximalParkingPrice(Configuration const *cfg, PaymentMethod methodId);
uint32_t getFirstDurationStep(Configuration const *cfg, PaymentMethod methodId); uint32_t getFirstDurationStep(Configuration const *cfg, PaymentMethod methodId);
uint32_t getTimeRangeStep(Configuration const *cfg, int step, PaymentMethod methodId);
BusinessHours getBusinessHours(Configuration const *cfg, PaymentMethod methodId); BusinessHours getBusinessHours(Configuration const *cfg, PaymentMethod methodId);
uint32_t computeWeekDaysPrice(Configuration const *cfg, PaymentMethod id); uint32_t computeWeekDaysPrice(Configuration const *cfg, PaymentMethod id);
double computeWeekDaysDurationUnit(Configuration const *cfg, PaymentMethod id); double computeWeekDaysDurationUnit(Configuration const *cfg, PaymentMethod id);

View File

@ -397,6 +397,14 @@ uint32_t Utilities::getMaximalParkingPrice(Configuration const *cfg, PaymentMeth
return std::max((int)cfg->PaymentOption.find(methodId)->second.pop_max_price, 0); return std::max((int)cfg->PaymentOption.find(methodId)->second.pop_max_price, 0);
} }
uint32_t Utilities::getTimeRangeStep(Configuration const *cfg, int step, PaymentMethod methodId) {
if (methodId == PaymentMethod::Progressive) {
return std::max((int)cfg->TimeRange.find(step)->second.time_range_to_in_minutes_from_start, 0);
}
return 0;
}
uint32_t Utilities::getFirstDurationStep(Configuration const *cfg, PaymentMethod methodId) { uint32_t Utilities::getFirstDurationStep(Configuration const *cfg, PaymentMethod methodId) {
int const popId = cfg->PaymentOption.find(methodId)->second.pop_id; int const popId = cfg->PaymentOption.find(methodId)->second.pop_id;