TDB2 & Task

- Fixed next_id handling in load_tasks.
- Removed unnecessary load in next_id.
- Added missing encode call.
index 8c0d2e9..3d1b7ce 100644
--- a/src/Task.cpp
+++ b/src/Task.cpp
@@ -528,7 +528,7 @@ std::string Task::composeF4 () const
     {
       ff4 += (first ? "" : " ")
            + it->first
-           + ":\"" + json::encode (it->second) + "\"";
+           + ":\"" + encode (json::encode (it->second)) + "\"";
       first = false;
     }
   }
This commit is contained in:
Paul Beckingham 2011-08-27 11:18:43 -04:00
parent 1392c8e619
commit 17dfbabb39
2 changed files with 5 additions and 8 deletions

View file

@ -101,7 +101,7 @@ void TF2::add_task (const Task& task)
_added_tasks.push_back (task); // For commit/synch
/*
int id = next_id ();
int id = context.tdb2.next_id ();
_I2U[id] = task.get ("uuid");
_U2I[task.get ("uuid")] = id;
*/
@ -233,7 +233,6 @@ void TF2::load_tasks ()
if (! _loaded_lines)
load_lines ();
int id = 1;
int line_number = 0;
try
{
@ -247,7 +246,9 @@ void TF2::load_tasks ()
Task::status status = task.getStatus ();
if (status != Task::deleted &&
status != Task::completed)
task.id = id++;
{
task.id = context.tdb2.next_id ();
}
_tasks.push_back (task);
@ -548,10 +549,6 @@ int TDB2::gc ()
// Next ID is that of the last pending task plus one.
int TDB2::next_id ()
{
if (! pending._loaded_tasks)
pending.load_tasks ();
_id = pending._tasks.back ().id + 1;
return _id++;
}

View file

@ -528,7 +528,7 @@ std::string Task::composeF4 () const
{
ff4 += (first ? "" : " ")
+ it->first
+ ":\"" + json::encode (it->second) + "\"";
+ ":\"" + encode (json::encode (it->second)) + "\"";
first = false;
}
}