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:
@@ -98,8 +98,8 @@ std::string handleProjects ()
|
||||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
int quantity = context.tdb.loadPending (tasks, context.filter);
|
||||
handleRecurrence (tasks);
|
||||
context.tdb.commit ();
|
||||
context.tdb.unlock ();
|
||||
|
||||
@@ -157,8 +157,8 @@ std::string handleTags ()
|
||||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
int quantity = context.tdb.loadPending (tasks, context.filter);
|
||||
handleRecurrence (tasks);
|
||||
context.tdb.commit ();
|
||||
context.tdb.unlock ();
|
||||
|
||||
@@ -455,8 +455,8 @@ std::string handleDelete ()
|
||||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
context.tdb.loadPending (tasks, context.filter);
|
||||
handleRecurrence (tasks);
|
||||
|
||||
// Filter sequence.
|
||||
context.filter.applySequence (tasks, context.sequence);
|
||||
@@ -553,8 +553,8 @@ std::string handleStart ()
|
||||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
context.tdb.loadPending (tasks, context.filter);
|
||||
handleRecurrence (tasks);
|
||||
|
||||
// Filter sequence.
|
||||
context.filter.applySequence (tasks, context.sequence);
|
||||
@@ -602,8 +602,8 @@ std::string handleStop ()
|
||||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
context.tdb.loadPending (tasks, context.filter);
|
||||
handleRecurrence (tasks);
|
||||
|
||||
// Filter sequence.
|
||||
context.filter.applySequence (tasks, context.sequence);
|
||||
@@ -648,8 +648,8 @@ std::string handleDone ()
|
||||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
context.tdb.loadPending (tasks, context.filter);
|
||||
handleRecurrence (tasks);
|
||||
|
||||
// Filter sequence.
|
||||
std::vector <Task> all = tasks;
|
||||
@@ -736,8 +736,8 @@ std::string handleExport ()
|
||||
// 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 ();
|
||||
|
||||
@@ -762,8 +762,8 @@ std::string handleModify ()
|
||||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
context.tdb.loadPending (tasks, context.filter);
|
||||
handleRecurrence (tasks);
|
||||
|
||||
// Filter sequence.
|
||||
std::vector <Task> all = tasks;
|
||||
@@ -824,8 +824,8 @@ std::string handleAppend ()
|
||||
|
||||
std::vector <Task> tasks;
|
||||
context.tdb.lock (context.config.get ("locking", true));
|
||||
handleRecurrence ();
|
||||
context.tdb.loadPending (tasks, context.filter);
|
||||
handleRecurrence (tasks);
|
||||
|
||||
// Filter sequence.
|
||||
std::vector <Task> all = tasks;
|
||||
|
||||
Reference in New Issue
Block a user