Bug #1023
- Fixed bug #1023, which applied default.project and default.priority during modification (thanks to Christoph Lange). - Added unit tests. - Added Christoph to the AUTHORS file.
This commit is contained in:
@@ -477,7 +477,7 @@ void TDB2::add (Task& task)
|
||||
void TDB2::modify (Task& task)
|
||||
{
|
||||
// Ensure the task is consistent, and provide defaults if necessary.
|
||||
task.validate ();
|
||||
task.validate (false);
|
||||
|
||||
// Find task, overwrite it.
|
||||
Task original;
|
||||
|
||||
@@ -1066,7 +1066,7 @@ void Task::substitute (
|
||||
// 2) To provide suitable warnings about odd states
|
||||
// 3) To generate errors when the inconsistencies are not fixable
|
||||
//
|
||||
void Task::validate ()
|
||||
void Task::validate (bool applyDefault /* = true */)
|
||||
{
|
||||
Task::status status = getStatus ();
|
||||
|
||||
@@ -1105,7 +1105,7 @@ void Task::validate ()
|
||||
setEnd ();
|
||||
|
||||
// Override with default.project, if not specified.
|
||||
if (! has ("project"))
|
||||
if (applyDefault && ! has ("project"))
|
||||
{
|
||||
std::string defaultProject = context.config.get ("default.project");
|
||||
if (defaultProject != "" &&
|
||||
@@ -1114,7 +1114,7 @@ void Task::validate ()
|
||||
}
|
||||
|
||||
// Override with default.priority, if not specified.
|
||||
if (get ("priority") == "")
|
||||
if (applyDefault && get ("priority") == "")
|
||||
{
|
||||
std::string defaultPriority = context.config.get ("default.priority");
|
||||
if (defaultPriority != "" &&
|
||||
@@ -1123,7 +1123,7 @@ void Task::validate ()
|
||||
}
|
||||
|
||||
// Override with default.due, if not specified.
|
||||
if (get ("due") == "")
|
||||
if (applyDefault && get ("due") == "")
|
||||
{
|
||||
std::string defaultDue = context.config.get ("default.due");
|
||||
if (defaultDue != "" &&
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
|
||||
void substitute (const std::string&, const std::string&, bool);
|
||||
|
||||
void validate ();
|
||||
void validate (bool applyDefault = true);
|
||||
|
||||
float urgency_c () const;
|
||||
float urgency ();
|
||||
|
||||
Reference in New Issue
Block a user