TW-1947: "urgency.over" filter seems to not work correct

- Thanks to Marc Richter.
This commit is contained in:
Paul Beckingham 2018-01-24 23:57:44 -05:00
parent c242730b6d
commit 751ae17b22
4 changed files with 35 additions and 7 deletions

View file

@ -318,3 +318,4 @@ suggestions:
Dan Callahan Dan Callahan
Martin Strunz Martin Strunz
Kai HTML Kai HTML
Marc Richter

View file

@ -73,6 +73,8 @@
(thanks to Paul J. Fenwick) (thanks to Paul J. Fenwick)
- TW-1938 Adjust behaviour of new-uuid and new-id verbosity levels - TW-1938 Adjust behaviour of new-uuid and new-id verbosity levels
(thanks to Paul J. Fenwick) (thanks to Paul J. Fenwick)
- TW-1947 "urgency.over" filter seems to not work correct
(thanks to Marc Richter).
- Added 'juhannus' as a synonym for 'midsommarafton' - Added 'juhannus' as a synonym for 'midsommarafton'
(thanks to Lynoure Braakman). (thanks to Lynoure Braakman).
- Deprecated the 'DUETODAY' virtual tag, which is a synonym for the 'TODAY' - Deprecated the 'DUETODAY' virtual tag, which is a synonym for the 'TODAY'

View file

@ -1279,7 +1279,7 @@ void CLI2::desugarFilterAttributes ()
A2 op ("", Lexer::Type::op); A2 op ("", Lexer::Type::op);
op.tag ("FILTER"); op.tag ("FILTER");
A2 rhs ("", Lexer::Type::string); A2 rhs ("", values[0]._lextype);
rhs.tag ("FILTER"); rhs.tag ("FILTER");
// Special case for '<name>:<value>'. // Special case for '<name>:<value>'.
@ -1372,16 +1372,21 @@ void CLI2::desugarFilterAttributes ()
reconstructed.push_back (op); reconstructed.push_back (op);
// Do not modify this construct without full understanding. // Do not modify this construct without full understanding.
if (values.size () == 1 || ! evalSupported) // Getting this wrong breaks a whole lot of filtering tests.
if (values.size () > 1 || evalSupported)
{ {
if (Lexer::isDOM (rhs.attribute ("raw"))) for (auto& v : values)
rhs._lextype = Lexer::Type::dom; reconstructed.push_back (v);
}
else if (Lexer::isDOM (rhs.attribute ("raw")))
{
rhs._lextype = Lexer::Type::dom;
reconstructed.push_back (rhs); reconstructed.push_back (rhs);
} }
else else
for (auto& v : values) {
reconstructed.push_back (v); reconstructed.push_back (rhs);
}
found = true; found = true;
} }

View file

@ -269,6 +269,16 @@ class TestOperatorsQuantity(TestCase):
self.assertNotIn("four", out) self.assertNotIn("four", out)
self.assertNotIn("five", out) self.assertNotIn("five", out)
def test_urgency_over(self):
"""operator urgency.over:10.0"""
code, out, err = self.t("ls urgency.over:10.0")
self.assertIn("one", out)
self.assertIn("two", out)
self.assertNotIn("three", out)
self.assertNotIn("four", out)
self.assertNotIn("five", out)
# < operator # # < operator #
def test_due_before(self): def test_due_before(self):
@ -331,6 +341,16 @@ class TestOperatorsQuantity(TestCase):
self.assertIn("four", out) self.assertIn("four", out)
self.assertIn("five", out) self.assertIn("five", out)
def test_urgency_under(self):
"""operator urgency.under:10.0"""
code, out, err = self.t("ls urgency.under:10.0")
self.assertNotIn("one", out)
self.assertNotIn("two", out)
self.assertIn("three", out)
self.assertIn("four", out)
self.assertIn("five", out)
# >= operator # # >= operator #
def test_due_greater_equal(self): def test_due_greater_equal(self):