Skip to content

Commit

Permalink
Rename some variables
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenDB committed Dec 8, 2022
1 parent 3d5c3c1 commit efb04ee
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/TimeEntryStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,17 @@ void TimeEntryStore::insert(const TimeEntry &t)
QTimer::singleShot(10, std::bind(&TimeEntryStore::insert, this, std::move(t)));
}

RangeSlice<TimeEntryStore::iterator> TimeEntryStore::sliceByDate(const QDateTime &oldest, const QDateTime &newest)
RangeSlice<TimeEntryStore::iterator> TimeEntryStore::sliceByDate(const QDateTime &from, const QDateTime &to)
{
auto start = std::find_if(
begin(), end(), [&newest, &oldest](const TimeEntry &t) { return t.start() <= std::max(newest, oldest); });
auto finish = std::find_if(
start, end(), [&newest, &oldest](const TimeEntry &t) { return t.start() < std::min(newest, oldest); });
auto start = std::find_if(begin(), end(), [&to, &from](const TimeEntry &t) { return t.start() <= std::max(to, from); });
auto finish = std::find_if(start, end(), [&to, &from](const TimeEntry &t) { return t.start() < std::min(to, from); });
return {start, finish};
}

RangeSlice<TimeEntryStore::const_iterator> TimeEntryStore::constSliceByDate(const QDateTime &oldest, const QDateTime &newest)
RangeSlice<TimeEntryStore::const_iterator> TimeEntryStore::constSliceByDate(const QDateTime &from, const QDateTime &to)
{
auto start = std::find_if(
cbegin(), cend(), [&newest, &oldest](const TimeEntry &t) { return t.start() <= std::max(newest, oldest); });
auto finish = std::find_if(
start, cend(), [&newest, &oldest](const TimeEntry &t) { return t.start() < std::min(newest, oldest); });
auto start =
std::find_if(cbegin(), cend(), [&to, &from](const TimeEntry &t) { return t.start() <= std::max(to, from); });
auto finish = std::find_if(start, cend(), [&to, &from](const TimeEntry &t) { return t.start() < std::min(to, from); });
return {start, finish};
}

0 comments on commit efb04ee

Please sign in to comment.