GetDailyTicketDuration():

replace ZellersAlgorithm by qts build in method dayOfWeek().
This commit is contained in:
Gerhard Hoffmann 2023-12-12 11:34:04 +01:00
parent ebb5bad7c5
commit 8d7d175b51

View File

@ -39,7 +39,7 @@ QDateTime Calculator::GetDailyTicketDuration(Configuration* cfg, const QDateTime
int daily_card_price = cfg->PaymentOption.find(payment_option)->second.pop_daily_card_price;
if(daily_card_price <= 0) {
qCritical() << "Calculator::GetDailyTicketDuration(): Daily ticket price zero or less");
qCritical() << "Calculator::GetDailyTicketDuration(): Daily ticket price zero or less";
return QDateTime();
}
@ -74,12 +74,10 @@ QDateTime Calculator::GetDailyTicketDuration(Configuration* cfg, const QDateTime
else
{
// Get day of week
int weekdayId = 0;
weekdayId = Utilities::ZellersAlgorithm(inputDateTime.date().day(),inputDateTime.date().month(),inputDateTime.date().year());
int const weekdayId = inputDateTime.date().dayOfWeek();
// If no working day found, skip it (recursively call method again)
size_t found = 0;
found = cfg->WeekDaysWorktime.count(weekdayId);
size_t found = cfg->WeekDaysWorktime.count(weekdayId);
// When no workday found, go to next available day
if(found <=0)