Task Validation

- Fixed validation bug whereby recurring child tasks inherited the
  parent status ("recurring") instead of the expected "pending".
- Modified 'add' command to code duplicated in Task::validate.
- Cleaned up associated bug.period.t unit test.
This commit is contained in:
Paul Beckingham
2011-08-31 01:34:59 -04:00
parent 8e34a02811
commit b09351c517
6 changed files with 24 additions and 32 deletions

View File

@@ -483,10 +483,13 @@ void TDB2::set_location (const std::string& location)
////////////////////////////////////////////////////////////////////////////////
// Add the new task to the appropriate file.
void TDB2::add (const Task& task)
void TDB2::add (Task& task)
{
// std::cout << "# TDB2::add\n";
// Ensure the task is consistent, and provide defaults if necessary.
task.validate ();
// If the tasks are loaded, then verify that this uuid is not already in
// the file.
if (!verifyUniqueUUID (task.get ("uuid")))
@@ -513,10 +516,13 @@ void TDB2::add (const Task& task)
}
////////////////////////////////////////////////////////////////////////////////
void TDB2::modify (const Task& task)
void TDB2::modify (Task& task)
{
// std::cout << "# TDB2::modify\n";
// Ensure the task is consistent, and provide defaults if necessary.
task.validate ();
// Update task in either completed or deleted.
// TODO Find task, overwrite it.
std::string status = task.get ("status");