CmdDefault: Implemented open interval summary

This commit is contained in:
Paul Beckingham 2016-03-22 00:37:10 -04:00
parent f2fbbf81bf
commit 653ea4b476

View file

@ -31,13 +31,20 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int CmdDefault (Rules& rules, Database& database) int CmdDefault (Rules& rules, Database& database)
{ {
std::cout << "[default command or current interval summary]\n";
// TODO If there is a default command. // TODO If there is a default command.
// TODO Run it. // TODO Run it.
// TODO Else. // TODO Else.
// TODO Load the most recent interval.
// TODO Summarїze the info and display. // Load the most recent interval, summarize and display.
auto interval = database.getLatestInterval ();
if (interval.isStarted () && ! interval.isEnded ())
std::cout << "\n"
<< database.getLatestInterval ().summarize ()
<< "\n";
else
std::cout << "\n"
<< "There is no active time tracking.\n"
<< "\n";
return 0; return 0;
} }