diff --git a/ChangeLog b/ChangeLog index b0135e09..4b5f527f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 --------------------------- diff --git a/src/commands/CmdJoin.cpp b/src/commands/CmdJoin.cpp index f1ae6d5e..f7dc1549 100644 --- a/src/commands/CmdJoin.cpp +++ b/src/commands/CmdJoin.cpp @@ -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); diff --git a/test/join.t b/test/join.t index d234f1db..f2f853e2 100755 --- a/test/join.t +++ b/test/join.t @@ -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__":