mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Use early return
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
6f439097d6
commit
b3799ede03
1 changed files with 35 additions and 38 deletions
|
@ -184,17 +184,15 @@ std::pair<int, int> Chart::determineHourRange (
|
||||||
const Interval &filter,
|
const Interval &filter,
|
||||||
const std::vector<Interval> &tracked)
|
const std::vector<Interval> &tracked)
|
||||||
{
|
{
|
||||||
// Default to the full day.
|
// If there is no data, show the whole day.
|
||||||
auto first_hour = 0;
|
if (tracked.empty ())
|
||||||
auto last_hour = 23;
|
|
||||||
|
|
||||||
// If there is no data,
|
|
||||||
// show the whole day.
|
|
||||||
if (!tracked.empty ())
|
|
||||||
{
|
{
|
||||||
|
return std::make_pair (0, 23);
|
||||||
|
}
|
||||||
|
|
||||||
// Get the extreme time range for the filtered data.
|
// Get the extreme time range for the filtered data.
|
||||||
first_hour = 23;
|
auto first_hour = 23;
|
||||||
last_hour = 0;
|
auto last_hour = 0;
|
||||||
|
|
||||||
for (Datetime day = filter.start; day < filter.end; day++)
|
for (Datetime day = filter.start; day < filter.end; day++)
|
||||||
{
|
{
|
||||||
|
@ -233,7 +231,6 @@ std::pair<int, int> Chart::determineHourRange (
|
||||||
first_hour = std::max (first_hour - 1, 0);
|
first_hour = std::max (first_hour - 1, 0);
|
||||||
last_hour = std::min (last_hour + 1, 23);
|
last_hour = std::min (last_hour + 1, 23);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_pair (first_hour, last_hour);
|
return std::make_pair (first_hour, last_hour);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue