Implement findWorkTimeRange() and indNextWorkTimeRange().
This commit is contained in:
parent
2b6d116200
commit
215667af61
@ -444,6 +444,35 @@ bool Calculator::checkDurationMinutes(bool overtime,
|
||||
return true;
|
||||
}
|
||||
|
||||
int Calculator::findWorkTimeRange(QDateTime const &dt,
|
||||
QScopedArrayPointer<TariffTimeRange> const &worktime,
|
||||
size_t size) {
|
||||
for (size_t w = 0; w < size; ++w) {
|
||||
QTime const &worktime_from = worktime[w].getTimeFrom();
|
||||
QTime const &worktime_to = worktime[w].getTimeUntil();
|
||||
|
||||
if ((dt.time() >= worktime_from) && (dt.time() < worktime_to)) {
|
||||
return w;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Calculator::findNextWorkTimeRange(QDateTime const &dt,
|
||||
QScopedArrayPointer<TariffTimeRange> const &worktime,
|
||||
size_t size) {
|
||||
int nextWorkTimeRange = -1;
|
||||
for (size_t w = 0; w < size; ++w) {
|
||||
QTime const &worktime_from = worktime[w].getTimeFrom();
|
||||
|
||||
if (dt.time() < worktime_from) {
|
||||
nextWorkTimeRange = w;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return nextWorkTimeRange;
|
||||
}
|
||||
|
||||
using namespace Utilities;
|
||||
|
||||
uint32_t Calculator::private_GetCostFromDuration(Configuration const* cfg,
|
||||
|
Loading…
Reference in New Issue
Block a user