mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Let command join merge tags of given intervals
This commit is contained in:
parent
de2c08ab82
commit
f5bbe5e1bc
3 changed files with 9 additions and 3 deletions
|
@ -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__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue