diff --git a/src/TDB2.cpp b/src/TDB2.cpp index d7d17d589..51235712c 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -572,7 +572,7 @@ void TDB2::add (Task& task, bool add_to_backlog /* = true */) if (add_to_backlog) context.hooks.onAdd (task); - update (uuid, task, add_to_backlog); + update (uuid, task, add_to_backlog, true); } //////////////////////////////////////////////////////////////////////////////// @@ -598,14 +598,15 @@ void TDB2::modify (Task& task, bool add_to_backlog /* = true */) void TDB2::update ( const std::string& uuid, Task& task, - const bool add_to_backlog) + const bool add_to_backlog, + const bool addition) { // Validate to add metadata. task.validate (false); // If the task already exists, it is a modification, else addition. Task original; - if (get (task.get ("uuid"), original)) + if (not addition && get (task.get ("uuid"), original)) { // Update the task, wherever it is. if (!pending.modify_task (task)) diff --git a/src/TDB2.h b/src/TDB2.h index bb3f2cd32..d019fc487 100644 --- a/src/TDB2.h +++ b/src/TDB2.h @@ -128,7 +128,7 @@ public: private: void gather_changes (); - void update (const std::string&, Task&, const bool); + void update (const std::string&, Task&, const bool, const bool addition = false); bool verifyUniqueUUID (const std::string&); void show_diff (const std::string&, const std::string&, const std::string&); void revert_undo (std::vector &, std::string&, std::string&, std::string&, std::string&);