TW-1640: '_get <id>.start' for an inactive tasks returns a date formatted from epoch 0.

This commit is contained in:
Paul Beckingham 2015-07-24 22:47:50 -04:00
parent ebbd20b719
commit 0f72d3d502
3 changed files with 22 additions and 3 deletions

View file

@ -79,6 +79,8 @@
- TW-1636 UUID with numeric-only first segment is not parsed properly (thanks
to Tomas Babej).
- TW-1638 Undo doesn't work when a context is set (thanks to Jeremy John Reeder).
- TW-1640 '_get <id>.start' for an inactive tasks returns a date formatted from
epoch 0.
- Prevent potential task duplication during import for non-pending tasks.
- Show the active context in "context list", if any is active.
- Fix "task edit" dropping annotation text after newlines.

View file

@ -233,7 +233,13 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value)
}
if (column->type () == "date")
value = Variant (task.get_date (canonical), Variant::type_date);
{
auto numeric = task.get_date (canonical);
if (numeric == 0)
value = Variant ("");
else
value = Variant (numeric, Variant::type_date);
}
else if (column->type () == "duration" || canonical == "recur")
value = Variant ((time_t) Duration (task.get (canonical)), Variant::type_duration);
else if (column->type () == "numeric")
@ -306,10 +312,16 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value)
}
if (column->type () == "date")
value = Variant (ref.get_date (canonical), Variant::type_date);
{
auto numeric = ref.get_date (canonical);
if (numeric == 0)
value = Variant ("");
else
value = Variant (numeric, Variant::type_date);
}
else if (column->type () == "duration")
{
std::string period = ref.get (canonical);
auto period = ref.get (canonical);
context.debug ("ref.get(" + canonical + ") --> " + period);
ISO8601p iso;

View file

@ -190,6 +190,11 @@ class TestDOM(TestCase):
code, out, err = self.t.runError("_get rc.missing")
self.assertEqual(code, 1)
def test_dom_attribute_missing(self):
"""DOM 1.end (missing)"""
code, out, err = self.t("_get 1.end")
self.assertEqual("\n", out)
if __name__ == "__main__":
from simpletap import TAPTestRunner