From 0825ce3c56a34cfb32149a28962f6b8896eacdac Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 6 Aug 2014 10:45:15 -0400 Subject: [PATCH] TDB2 - Updated ID:UUID mapping on ::add, which is the first part of the fix for TW-1389. --- src/TDB2.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/TDB2.cpp b/src/TDB2.cpp index a6428d250..296be7118 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -140,11 +140,18 @@ void TF2::add_task (const Task& task) _tasks.push_back (hookTask); // For subsequent queries _added_tasks.push_back (hookTask); // For commit/synch -/* TODO handle 'add' and 'log'? - int id = context.tdb2.next_id (); + int id = task.id; + Task::status status = task.getStatus (); + if (id == 0 && + (status == Task::pending || + status == Task::recurring || + status == Task::waiting)) + { + id = context.tdb2.next_id (); + } + _I2U[id] = task.get ("uuid"); _U2I[task.get ("uuid")] = id; -*/ _dirty = true; }