Let command join merge tags of given intervals

This commit is contained in:
Thomas Lauf 2019-01-20 23:22:36 +01:00
parent de2c08ab82
commit f5bbe5e1bc
3 changed files with 9 additions and 3 deletions

View file

@ -44,6 +44,7 @@
- Fixed error from totals.py while timer is active
(thanks to davisdude)
- Refactoring of Interval and Range
- Let command join merge tags of given intervals
------ current release ---------------------------

View file

@ -69,10 +69,15 @@ int CmdJoin (
Interval second = tracked[tracked.size () - second_id];
// TODO Require confirmation if intervals are not consecutive.
// TODO Require confirmation if tags don't match.
auto combined = second;
combined.end = first.end;
for (auto& tag: first.tags ())
{
combined.tag (tag);
}
database.deleteInterval (first);
database.deleteInterval (second);

View file

@ -66,7 +66,7 @@ class TestJoin(TestCase):
self.assertClosedInterval(j[0],
expectedStart="{:%Y%m%dT%H%M%S}Z".format(five_hours_before_utc),
expectedEnd="{:%Y%m%dT%H%M%S}Z".format(one_hour_before_utc),
expectedTags=["foo"])
expectedTags=["foo", "bar"])
def test_join_closed_and_open_interval(self):
"""Join closed and open interval"""
@ -90,7 +90,7 @@ class TestJoin(TestCase):
self.assertEqual(len(j), 1)
self.assertOpenInterval(j[0],
expectedStart="{:%Y%m%dT%H%M%S}Z".format(five_hours_before_utc),
expectedTags=["foo"])
expectedTags=["foo", "bar"])
if __name__ == "__main__":