mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug 449 - Inconsistent wait: attribute results
- Fixed bug #449, so the wait: attribute can be applied to a task at any time, not just on add. - While searching for problems with the waiting status, noticed that importCSV doesn't appear to set any tasks to pending status.
This commit is contained in:
parent
4d266412ee
commit
2ef30b1183
4 changed files with 30 additions and 6 deletions
|
@ -43,6 +43,8 @@
|
||||||
values.
|
values.
|
||||||
+ Fixed bug #444, which made task shell unusable after canceling out of an
|
+ Fixed bug #444, which made task shell unusable after canceling out of an
|
||||||
undo command.
|
undo command.
|
||||||
|
+ Fixed bug #449, so the wait: attribute can be applied to a task at any
|
||||||
|
time, not just on add.
|
||||||
|
|
||||||
------ old releases ------------------------------
|
------ old releases ------------------------------
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,12 @@ int handleAdd (std::string &outs)
|
||||||
context.task.setStatus (Task::recurring);
|
context.task.setStatus (Task::recurring);
|
||||||
context.task.set ("mask", "");
|
context.task.set ("mask", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tasks with a wait: date get a special status.
|
||||||
else if (context.task.has ("wait"))
|
else if (context.task.has ("wait"))
|
||||||
context.task.setStatus (Task::waiting);
|
context.task.setStatus (Task::waiting);
|
||||||
|
|
||||||
|
// By default, tasks are pending.
|
||||||
else
|
else
|
||||||
context.task.setStatus (Task::pending);
|
context.task.setStatus (Task::pending);
|
||||||
|
|
||||||
|
@ -1335,7 +1339,8 @@ int handleDone (std::string &outs)
|
||||||
bool nagged = false;
|
bool nagged = false;
|
||||||
foreach (task, tasks)
|
foreach (task, tasks)
|
||||||
{
|
{
|
||||||
if ((task->getStatus () == Task::pending) || (task->getStatus () == Task::waiting))
|
if (task->getStatus () == Task::pending ||
|
||||||
|
task->getStatus () == Task::waiting)
|
||||||
{
|
{
|
||||||
Task before (*task);
|
Task before (*task);
|
||||||
|
|
||||||
|
@ -2298,9 +2303,15 @@ int deltaAttributes (Task& task)
|
||||||
if (att->second.name () == "wait")
|
if (att->second.name () == "wait")
|
||||||
{
|
{
|
||||||
if (att->second.value () == "")
|
if (att->second.value () == "")
|
||||||
|
{
|
||||||
|
task.remove (att->first);
|
||||||
task.setStatus (Task::pending);
|
task.setStatus (Task::pending);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
task.set (att->first, att->second.value ());
|
||||||
task.setStatus (Task::waiting);
|
task.setStatus (Task::waiting);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modifying dependencies requires adding/removing uuids.
|
// Modifying dependencies requires adding/removing uuids.
|
||||||
|
|
|
@ -1075,6 +1075,7 @@ static std::string importCSV (const std::vector <std::string>& lines)
|
||||||
{
|
{
|
||||||
std::string value = lowerCase (unquoteText (trim (fields[f])));
|
std::string value = lowerCase (unquoteText (trim (fields[f])));
|
||||||
|
|
||||||
|
// TODO What happened to "pending"?
|
||||||
if (value == "recurring") task.setStatus (Task::recurring);
|
if (value == "recurring") task.setStatus (Task::recurring);
|
||||||
else if (value == "deleted") task.setStatus (Task::deleted);
|
else if (value == "deleted") task.setStatus (Task::deleted);
|
||||||
else if (value == "completed") task.setStatus (Task::completed);
|
else if (value == "completed") task.setStatus (Task::completed);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 9;
|
use Test::More tests => 13;
|
||||||
|
|
||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'wait.rc')
|
if (open my $fh, '>', 'wait.rc')
|
||||||
|
@ -41,15 +41,25 @@ if (open my $fh, '>', 'wait.rc')
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add a waiting task, check it is not there, wait, then check it is.
|
# Add a waiting task, check it is not there, wait, then check it is.
|
||||||
qx{../task rc:wait.rc add -- yeswait};
|
qx{../task rc:wait.rc add yeswait wait:2s};
|
||||||
qx{../task rc:wait.rc add -- nowait};
|
qx{../task rc:wait.rc add nowait};
|
||||||
qx{../task rc:wait.rc 1 wait:1s};
|
|
||||||
|
|
||||||
my $output = qx{../task rc:wait.rc ls};
|
my $output = qx{../task rc:wait.rc ls};
|
||||||
like ($output, qr/nowait/ms, 'non-waiting task visible');
|
like ($output, qr/nowait/ms, 'non-waiting task visible');
|
||||||
unlike ($output, qr/yeswait/ms, 'waiting task invisible');
|
unlike ($output, qr/yeswait/ms, 'waiting task invisible');
|
||||||
|
|
||||||
sleep 2;
|
sleep 3;
|
||||||
|
|
||||||
|
$output = qx{../task rc:wait.rc ls};
|
||||||
|
like ($output, qr/nowait/ms, 'non-waiting task still visible');
|
||||||
|
like ($output, qr/yeswait/ms, 'waiting task now visible');
|
||||||
|
|
||||||
|
qx{../task rc:wait.rc 1 wait:2s};
|
||||||
|
$output = qx{../task rc:wait.rc ls};
|
||||||
|
like ($output, qr/nowait/ms, 'non-waiting task visible');
|
||||||
|
unlike ($output, qr/yeswait/ms, 'waiting task invisible');
|
||||||
|
|
||||||
|
sleep 3;
|
||||||
|
|
||||||
$output = qx{../task rc:wait.rc ls};
|
$output = qx{../task rc:wait.rc ls};
|
||||||
like ($output, qr/nowait/ms, 'non-waiting task still visible');
|
like ($output, qr/nowait/ms, 'non-waiting task still visible');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue