CmdChart: Fixed bug where having no tracked intervals yielded an incorrect hour range

This commit is contained in:
Paul Beckingham 2016-06-04 10:34:46 -04:00
parent 8371ce7937
commit 149745867d

View file

@ -216,6 +216,12 @@ static void determineHourRange (
int& last_hour) int& last_hour)
{ {
if (rules.get ("reports." + type + ".hours") == "auto") if (rules.get ("reports." + type + ".hours") == "auto")
{
first_hour = 0;
last_hour = 23;
// If there is no data, show the whole day.
if (tracked.size ())
{ {
// Get the extreme time range for the filtered data. // Get the extreme time range for the filtered data.
first_hour = 23; first_hour = 23;
@ -232,6 +238,7 @@ static void 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);
} }
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////