- Fixed bug #837, which caused incorrect urgency calculations for tasks that
  have completed dependencies, and problems when editing those tasks (thanks
  to Matt Kraai).
- Added Task::addDependency (const std::string&) method for reconstructing
  dependencies on tasks with no ID.
- Modfified Task::urgency_blocked so that it considers the blocking task's
  status.  This is an expensive test, and so it is wrapped by a cheaper test
  to see if there are/were any dependencies at all.  This means that urgency
  calculations are not slowed for tasks without dependencies, and is slower
  but more accurate for tasks that do have dependencies.
- Modified edit command so that dependencies are shown as IDs or UUIDs
  depending on whether the task is pending or not.
- Modified edit command so that dependencies are parsed as IDs or UUIDs
  depending on whether the task is pending or not.
- Modified wording in the template of the edit command to reflect the above.
- Added unit tests bug.837.t.
This commit is contained in:
Paul Beckingham
2012-03-04 00:05:11 -05:00
parent 1582fb1f88
commit 77200d7eb4
6 changed files with 142 additions and 7 deletions

View File

@@ -212,15 +212,27 @@ std::string CmdEdit::formatTask (Task task)
before << " Annotation: " << now.toString (context.config.get ("dateformat.annotation")) << " -- \n";
// Add dependencies here.
std::vector <int> dependencies;
std::vector <std::string> dependencies;
task.getDependencies (dependencies);
std::string allDeps;
join (allDeps, ",", dependencies);
std::stringstream allDeps;
for (unsigned int i = 0; i < dependencies.size (); ++i)
{
if (i)
allDeps << ",";
Task t;
context.tdb2.get (dependencies[i], t);
if (t.getStatus () == Task::pending ||
t.getStatus () == Task::waiting)
allDeps << t.id;
else
allDeps << dependencies[i];
}
if (verbose)
before << "# " << STRING_EDIT_DEP_SEP << "\n";
before << " Dependencies: " << allDeps << "\n";
before << " Dependencies: " << allDeps.str () << "\n";
before << "# " << STRING_EDIT_END << "\n";
return before.str ();
@@ -582,9 +594,18 @@ void CmdEdit::parseTask (Task& task, const std::string& after)
std::vector <std::string>::iterator dep;
for (dep = dependencies.begin (); dep != dependencies.end (); ++dep)
{
int id = atoi (dep->c_str ());
int id = 0;
// Crude UUID check.
if (dep->length () == 36)
id = context.tdb2.pending.id (*dep);
else
id = atoi (dep->c_str ());
if (id)
task.addDependency (id);
else
task.addDependency (*dep);
}
}