Permalink
Browse files

Let command join merge tags of given intervals

  • Loading branch information...
lauft committed Jan 20, 2019
1 parent de2c08a commit f5bbe5e1bc23e4e8eced4189092a4ef505b93a8f
Showing with 9 additions and 3 deletions.
  1. +1 −0 ChangeLog
  2. +6 −1 src/commands/CmdJoin.cpp
  3. +2 −2 test/join.t
@@ -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 ---------------------------

@@ -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);

@@ -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__":

0 comments on commit f5bbe5e

Please sign in to comment.