mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-01 18:27:20 +02:00
Deletion
- An already-completed task may now also be deleted. - Added unit tests.
This commit is contained in:
parent
fce2469f41
commit
e5303a2180
3 changed files with 19 additions and 16 deletions
21
src/TDB2.cpp
21
src/TDB2.cpp
|
@ -145,7 +145,7 @@ void TF2::add_task (const Task& task)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TF2::modify_task (const Task& task)
|
||||
bool TF2::modify_task (const Task& task)
|
||||
{
|
||||
// Modify in-place.
|
||||
std::string uuid = task.get ("uuid");
|
||||
|
@ -155,12 +155,13 @@ void TF2::modify_task (const Task& task)
|
|||
if (i->get ("uuid") == uuid)
|
||||
{
|
||||
*i = task;
|
||||
break;
|
||||
_modified_tasks.push_back (task);
|
||||
_dirty = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
_modified_tasks.push_back (task);
|
||||
_dirty = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -522,17 +523,9 @@ void TDB2::modify (Task& task)
|
|||
|
||||
if (taskDiff (original, task))
|
||||
{
|
||||
std::string status = original.get ("status");
|
||||
if (status == "pending" ||
|
||||
status == "waiting" ||
|
||||
status == "recurring")
|
||||
{
|
||||
pending.modify_task (task);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update the task, wherever it is.
|
||||
if (!pending.modify_task (task))
|
||||
completed.modify_task (task);
|
||||
}
|
||||
|
||||
// time <time>
|
||||
// old <task>
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
const std::string& get_contents ();
|
||||
|
||||
void add_task (const Task&);
|
||||
void modify_task (const Task&);
|
||||
bool modify_task (const Task&);
|
||||
void add_line (const std::string&);
|
||||
void clear_lines ();
|
||||
void commit ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue