CmdDefault: Returns 1 when there is no active tracking

This commit is contained in:
Paul Beckingham 2016-04-15 17:20:21 -04:00
parent 87698fe474
commit eff59b6124

View file

@ -30,20 +30,27 @@
#include <iostream> #include <iostream>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Returns 0 if tracking is active, 1 if not.
int CmdDefault (Rules& rules, Database& database) int CmdDefault (Rules& rules, Database& database)
{ {
if (rules.getBoolean ("verbose")) int status = 0;
{
// Load the most recent interval, summarize and display.
auto interval = getLatestInterval (database);
if (interval.isStarted () && ! interval.isEnded ()) // Load the most recent interval, summarize and display.
auto interval = getLatestInterval (database);
if (interval.isStarted () && ! interval.isEnded ())
{
if (rules.getBoolean ("verbose"))
std::cout << intervalSummarize (rules, interval); std::cout << intervalSummarize (rules, interval);
else }
else
{
if (rules.getBoolean ("verbose"))
std::cout << "There is no active time tracking.\n"; std::cout << "There is no active time tracking.\n";
status = 1;
} }
return 0; return status;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////