Bug - import.yaml

- Fixed bug in import for YAML and TODO that failed to recognize that
  a task was completed or deleted, and consequently set a Task::pending
  status.
- Enhanced unit tests to verify this.
This commit is contained in:
Paul Beckingham 2010-08-08 11:06:58 -04:00
parent 41f2520094
commit 5b8dbd8ff1
3 changed files with 66 additions and 10 deletions

View file

@ -457,9 +457,18 @@ const std::vector <Task>& TDB::getAllModified ()
// Note: mLocations[0] is where all tasks are written.
void TDB::add (const Task& task)
{
mNew.push_back (task);
mI2U[task.id] = task.get ("uuid");
mU2I[task.get ("uuid")] = task.id;
Task t (task);
if (task.get ("uuid") == "")
{
std::string unique = ::uuid ();
t.set ("uuid", unique);
}
else
t.set ("uuid", task.get ("uuid"));
mNew.push_back (t);
mI2U[task.id] = t.get ("uuid");
mU2I[task.get ("uuid")] = t.id;
}
////////////////////////////////////////////////////////////////////////////////