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:
10
src/TDB2.cpp
10
src/TDB2.cpp
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user