GetDailyTicketDuration():
replace ZellersAlgorithm by qts build in method dayOfWeek().
This commit is contained in:
parent
ebb5bad7c5
commit
8d7d175b51
@ -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;
|
int daily_card_price = cfg->PaymentOption.find(payment_option)->second.pop_daily_card_price;
|
||||||
if(daily_card_price <= 0) {
|
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();
|
return QDateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,12 +74,10 @@ QDateTime Calculator::GetDailyTicketDuration(Configuration* cfg, const QDateTime
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Get day of week
|
// Get day of week
|
||||||
int weekdayId = 0;
|
int const weekdayId = inputDateTime.date().dayOfWeek();
|
||||||
weekdayId = Utilities::ZellersAlgorithm(inputDateTime.date().day(),inputDateTime.date().month(),inputDateTime.date().year());
|
|
||||||
|
|
||||||
// If no working day found, skip it (recursively call method again)
|
// If no working day found, skip it (recursively call method again)
|
||||||
size_t found = 0;
|
size_t found = cfg->WeekDaysWorktime.count(weekdayId);
|
||||||
found = cfg->WeekDaysWorktime.count(weekdayId);
|
|
||||||
|
|
||||||
// When no workday found, go to next available day
|
// When no workday found, go to next available day
|
||||||
if(found <=0)
|
if(found <=0)
|
||||||
|
Loading…
Reference in New Issue
Block a user