Bug #461 - due:today doesn't work as a filter - due.is:today does

- Fixed bug #461, in which the filter 'due:today' failed, but 'due.is:today'
  worked.  This is because while iterating over tasks, not every task has a
  due date, in which case Date::Date ("") was called, which fails.
- Moved 'wait' up to second position in the Att::type method, for efficiency.
This commit is contained in:
Paul Beckingham 2010-08-30 23:30:48 -04:00
parent f2a5dde3a6
commit 69ac9a4296
4 changed files with 20 additions and 10 deletions

View file

@ -61,6 +61,8 @@
and overdue.
+ Fixed bug #459, which showed a confusing message when 'limit:page' was
used, with few tasks.
+ Fixed bug #461, in which the filter 'due:today' failed, but 'due.is:today'
worked.
+ Fixed bug #466, which gave the wrong error message when a custom report
was missing a direction indicator for the sort order.
+ Fixed bug #470, which caused task to not support the color 'none'.

View file

@ -438,11 +438,11 @@ bool Att::validMod (const std::string& mod)
std::string Att::type (const std::string& name) const
{
if (name == "due" ||
name == "wait" ||
name == "until" ||
name == "start" ||
name == "entry" ||
name == "end" ||
name == "wait")
name == "end")
return "date";
else if (name == "recur")
@ -542,16 +542,17 @@ bool Att::match (const Att& other) const
if (mMod == "")
{
// Exact matches on dates should only compare m/d/y, not h:m:s. This allows
// Comapisons like "task list due:today" (bug #405).
// comparisons like "task list due:today" (bug #405).
std::string which = type (mName);
if (which == "date")
{
if (other.mValue == "")
return false;
Date left (mValue);
Date right (other.mValue);
if (left.year () != right.year () ||
left.month () != right.month () ||
left.day () != right.day ())
if (! left.sameDay (right))
return false;
}
else

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 7;
use Test::More tests => 9;
# Create the rc file.
if (open my $fh, '>', 'due.rc')
@ -57,6 +57,13 @@ my $output = qx{../task rc:due.rc list};
like ($output, qr/\[31m.+$just.+\[0m/, 'one marked due');
like ($output, qr/\s+$almost\s+/, 'two not marked due');
qx{../task rc:due.rc add three due:today};
$output = qx{../task rc:due.rc list due:today};
like ($output, qr/three/, 'due:today works as a filter');
$output = qx{../task rc:due.rc list due.is:today};
like ($output, qr/three/, 'due.is:today works as a filter');
# Cleanup.
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');

View file

@ -71,8 +71,8 @@ qx{../task rc:wait.rc add wait:tomorrow tomorrow};
$output = qx{../task rc:wait.rc ls};
unlike ($output, qr/tomorrow/ms, 'waiting task invisible');
$output = qx{../task rc:wait.rc ls wait:tomorrow};
like ($output, qr/tomorrow/ms, 'waiting task visible when specifically asked for it');
$output = qx{../task rc:wait.rc all status:waiting wait:tomorrow};
like ($output, qr/tomorrow/ms, 'waiting task visible when specifically queried');
# Cleanup.
unlink 'pending.data';