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

@@ -415,7 +415,7 @@ bool Att::validNameValue (
"\" is not a valid status. Use 'pending', 'completed', 'deleted', 'recurring' or 'waiting'.";
}
else if (! validInternalName (name) &&
else if (! validInternalName (name) &&
! validModifiableName (name))
throw std::string ("'") + name + "' is not a recognized attribute.";
@@ -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