Bug Fix - recurrence

- Fixed bug whereby handleRecurrence was being called after the tasks
  were loaded and filtered, and thus handleRecurrence operated on a
  filtered set, and failed.  The fix is to move the call to before the
  TDB::load call, and to add another TDB::loadPending call inside
  handleRecurrence.  This means TDB::load needs to be reentrant without
  re-reading the file, and can therefore be called twice, with the
  likelihood of there being a different filter for each call.  This in
  turn led to the problem whereby handleRecurrence would generate the
  synthetic tasks, which then sat uncommitted in TDB::mNew.  The fix
  for this is that every call to TDB::loadPending gets the contents of
  TDB::mNew appended (with correct IDs).  This bug is what you might
  call a good one.
This commit is contained in:
Paul Beckingham 2009-06-19 00:15:38 -04:00
parent 20bd2cf594
commit 8dab95e200
7 changed files with 62 additions and 43 deletions

View file

@ -268,8 +268,8 @@ std::string handleInfo ()
// Get all the tasks.
std::vector <Task> tasks;
context.tdb.lock (context.config.get ("locking", true));
handleRecurrence ();
context.tdb.loadPending (tasks, context.filter);
handleRecurrence (tasks);
context.tdb.commit ();
context.tdb.unlock ();
@ -485,8 +485,8 @@ std::string handleReportSummary ()
// Scan the pending tasks.
std::vector <Task> tasks;
context.tdb.lock (context.config.get ("locking", true));
handleRecurrence ();
context.tdb.load (tasks, context.filter);
handleRecurrence (tasks);
context.tdb.commit ();
context.tdb.unlock ();
@ -650,8 +650,8 @@ std::string handleReportNext ()
// Get all the tasks.
std::vector <Task> tasks;
context.tdb.lock (context.config.get ("locking", true));
handleRecurrence ();
context.tdb.loadPending (tasks, context.filter);
handleRecurrence (tasks);
context.tdb.commit ();
context.tdb.unlock ();
@ -814,8 +814,8 @@ std::string handleReportHistory ()
// Scan the pending tasks.
std::vector <Task> tasks;
context.tdb.lock (context.config.get ("locking", true));
handleRecurrence ();
context.tdb.load (tasks, context.filter);
handleRecurrence (tasks);
context.tdb.commit ();
context.tdb.unlock ();
@ -968,8 +968,8 @@ std::string handleReportGHistory ()
// Scan the pending tasks.
std::vector <Task> tasks;
context.tdb.lock (context.config.get ("locking", true));
handleRecurrence ();
context.tdb.load (tasks, context.filter);
handleRecurrence (tasks);
context.tdb.commit ();
context.tdb.unlock ();
@ -1159,8 +1159,8 @@ std::string handleReportTimesheet ()
// Scan the pending tasks.
std::vector <Task> tasks;
context.tdb.lock (context.config.get ("locking", true));
handleRecurrence ();
context.tdb.load (tasks, context.filter);
handleRecurrence (tasks);
context.tdb.commit ();
context.tdb.unlock ();
@ -1490,8 +1490,8 @@ std::string handleReportCalendar ()
// Get all the tasks.
std::vector <Task> tasks;
context.tdb.lock (context.config.get ("locking", true));
handleRecurrence ();
context.tdb.loadPending (tasks, context.filter);
handleRecurrence (tasks);
context.tdb.commit ();
context.tdb.unlock ();
@ -1613,8 +1613,8 @@ std::string handleReportStats ()
// Get all the tasks.
std::vector <Task> tasks;
context.tdb.lock (context.config.get ("locking", true));
handleRecurrence ();
context.tdb.load (tasks, context.filter);
handleRecurrence (tasks);
context.tdb.commit ();
context.tdb.unlock ();