Enhancement - history report

- Implemented history report.
- Improved (not to the point of them working) filters.
- Improved automatic filter construction.
- Removed obsolete members from Task.
- Added tag support to the "add" command.
This commit is contained in:
Paul Beckingham
2009-06-14 12:09:57 -04:00
parent 85e38e67d3
commit 9f6b112003
7 changed files with 89 additions and 111 deletions

View File

@@ -173,8 +173,8 @@ std::string Context::dispatch ()
else if (cmd.command == "help") { out = longUsage (); }
else if (cmd.command == "stats") { out = handleReportStats (); }
else if (cmd.command == "info") { out = handleInfo (); }
/*
else if (cmd.command == "history") { out = handleReportHistory (); }
/*
else if (cmd.command == "ghistory") { out = handleReportGHistory (); }
else if (cmd.command == "calendar") { out = handleReportCalendar (); }
else if (cmd.command == "summary") { out = handleReportSummary (); }
@@ -365,6 +365,7 @@ std::cout << "# parse tag addition '" << *arg << "'" << std::endl;
foundSomethingAfterSequence = true;
tagAdditions.push_back (arg->substr (1, std::string::npos));
task.addTag (arg->substr (1, std::string::npos));
}
// Tags to remove begin with '-'.
@@ -451,7 +452,7 @@ std::cout << "# parse post-termination description '" << *arg << "'"
}
}
if (noVerticalSpace (descCandidate))
if (descCandidate != "" && noVerticalSpace (descCandidate))
task.set ("description", descCandidate);
// TODO task.validate ()
@@ -484,16 +485,46 @@ std::cout << "# parse post-termination description '" << *arg << "'"
void Context::constructFilter ()
{
foreach (att, task)
if (att->first != "uuid")
filter.push_back (att->second);
// TODO this doesn't work.
if (task.has ("description"))
{
std::vector <std::string> words;
split (words, task.get ("description"), ' ');
foreach (word, words)
filter.push_back (Att ("description", "contains", *word));
// TODO this doesn't work.
if (att->first == "description")
{
std::vector <std::string> words;
split (words, att->second.value (), ' ');
foreach (word, words)
{
filter.push_back (Att ("description", "has", *word));
std::cout << "Context::constructFilter " << att->first << "=" << att->second.value () << std::endl;
}
}
// TODO Don't create a uuid for every task?
// Every task has a unique uuid by default, and it shouldn't be included.
// The mechanism for filtering on tags is +/-<tag>, not tags:foo which
// means that there can only be one tag, "foo".
else if (att->first != "uuid" &&
att->first != "tags")
{
filter.push_back (att->second);
std::cout << "Context::constructFilter " << att->first << "=" << att->second.value () << std::endl;
}
}
// TODO Include Annotations as part of the description?
// Include tagAdditions.
foreach (tag, tagAdditions)
{
filter.push_back (Att ("tags", "has", *tag));
std::cout << "Context::constructFilter tags=+" << *tag << std::endl;
}
// TODO Include tagRemovals.
foreach (tag, tagRemovals)
{
filter.push_back (Att ("tags", "hasnt", *tag));
std::cout << "Context::constructFilter tags=-" << *tag << std::endl;
}
}