From 8d43897e26d0979184978ee731331e051fb086ed Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 12 Aug 2015 22:17:01 -0400 Subject: Fix bug task estimate is reseted when using subtask timer --- ChangeLog | 1 + app/Model/SubtaskTimeTracking.php | 8 +++----- composer.json | 4 ++-- composer.lock | 26 +++++++++++++------------- tests/units/SubtaskTimeTrackingTest.php | 7 +++++-- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e0072c0..6c29301b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ Bug fixes: * Wrong template name for subtasks tooltip due to previous refactoring * Fix broken url for closed tasks in project view * Fix permission issue when changing the url manually +* Fix bug task estimate is reseted when using subtask timer Version 1.0.17 -------------- diff --git a/app/Model/SubtaskTimeTracking.php b/app/Model/SubtaskTimeTracking.php index 9f17ee3f..8f8aac94 100644 --- a/app/Model/SubtaskTimeTracking.php +++ b/app/Model/SubtaskTimeTracking.php @@ -301,7 +301,6 @@ class SubtaskTimeTracking extends Base ->findOneColumn('start'); if ($start_time) { - $start = new DateTime; $start->setTimestamp($start_time); @@ -349,10 +348,9 @@ class SubtaskTimeTracking extends Base return $this->db ->table(Task::TABLE) ->eq('id', $task_id) - ->update(array( - 'time_spent' => $result['total_spent'], - 'time_estimated' => $result['total_estimated'], - )); + ->sumColumn('time_spent', $result['total_spent']) + ->sumColumn('time_estimated', $result['total_estimated']) + ->update(); } /** diff --git a/composer.json b/composer.json index c1f12c6f..a2b41f57 100644 --- a/composer.json +++ b/composer.json @@ -7,8 +7,8 @@ "eluceo/ical": "0.8.0", "erusev/parsedown" : "1.5.3", "fabiang/xmpp" : "0.6.1", - "fguillot/json-rpc" : "dev-master", - "fguillot/picodb" : "1.0.0", + "fguillot/json-rpc" : "1.0.1", + "fguillot/picodb" : "1.0.1", "fguillot/simpleLogger" : "0.0.2", "fguillot/simple-validator" : "0.0.3", "nickcernis/html-to-markdown" : "2.2.1", diff --git a/composer.lock b/composer.lock index 6ec8ac46..8dfc3e46 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "aa2376c6b4ac36457adf8cf46f584fd9", + "hash": "f708764553321994743c3d42c4d6e512", "packages": [ { "name": "christian-riesen/base32", @@ -260,20 +260,20 @@ }, { "name": "fguillot/json-rpc", - "version": "dev-master", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/fguillot/JsonRPC.git", - "reference": "050f046b1cae99210ae2fe64618831d3961f5bd9" + "reference": "9a117e964c4c6ad026da7ae1ca155f7686e3deaf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/JsonRPC/zipball/050f046b1cae99210ae2fe64618831d3961f5bd9", - "reference": "050f046b1cae99210ae2fe64618831d3961f5bd9", + "url": "https://api.github.com/repos/fguillot/JsonRPC/zipball/9a117e964c4c6ad026da7ae1ca155f7686e3deaf", + "reference": "9a117e964c4c6ad026da7ae1ca155f7686e3deaf", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=5.3.4" }, "type": "library", "autoload": { @@ -292,20 +292,20 @@ ], "description": "Simple Json-RPC client/server library that just works", "homepage": "https://github.com/fguillot/JsonRPC", - "time": "2015-07-29 20:56:20" + "time": "2015-08-07 22:31:21" }, { "name": "fguillot/picodb", - "version": "v1.0.0", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/fguillot/picoDb.git", - "reference": "6d9e2314a7aa2893a49c7da7b66f7352bd6ea296" + "reference": "8a311523d114180e04a1e08ced6766f26d7ebbae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoDb/zipball/6d9e2314a7aa2893a49c7da7b66f7352bd6ea296", - "reference": "6d9e2314a7aa2893a49c7da7b66f7352bd6ea296", + "url": "https://api.github.com/repos/fguillot/picoDb/zipball/8a311523d114180e04a1e08ced6766f26d7ebbae", + "reference": "8a311523d114180e04a1e08ced6766f26d7ebbae", "shasum": "" }, "require": { @@ -329,7 +329,7 @@ ], "description": "Minimalist database query builder", "homepage": "https://github.com/fguillot/picoDb", - "time": "2015-06-27 16:13:40" + "time": "2015-08-13 01:44:29" }, { "name": "fguillot/simple-validator", @@ -805,11 +805,11 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "fguillot/json-rpc": 20, "swiftmailer/swiftmailer": 0, "symfony/console": 0 }, "prefer-stable": false, + "prefer-lowest": false, "platform": { "php": ">=5.3", "ext-mbstring": "*", diff --git a/tests/units/SubtaskTimeTrackingTest.php b/tests/units/SubtaskTimeTrackingTest.php index 27ba7c7d..661812d4 100644 --- a/tests/units/SubtaskTimeTrackingTest.php +++ b/tests/units/SubtaskTimeTrackingTest.php @@ -209,6 +209,9 @@ class SubtaskTimeTrackingTest extends Base $this->assertEquals(1, $s->create(array('title' => 'subtask #1', 'task_id' => 1, 'time_spent' => 2.2))); $this->assertEquals(2, $s->create(array('title' => 'subtask #2', 'task_id' => 1, 'time_estimated' => 1))); + $this->assertEquals(3, $s->create(array('title' => 'subtask #3', 'task_id' => 2, 'time_spent' => 3.4))); + $this->assertEquals(4, $s->create(array('title' => 'subtask #4', 'task_id' => 2, 'time_estimated' => 1.25))); + $st->updateTaskTimeTracking(1); $st->updateTaskTimeTracking(2); @@ -219,8 +222,8 @@ class SubtaskTimeTrackingTest extends Base $task = $tf->getById(2); $this->assertNotEmpty($task); - $this->assertEquals(0.5, $task['time_spent'], 'Total spent', 0.01); - $this->assertEquals(1.5, $task['time_estimated'], 'Total estimated', 0.01); + $this->assertEquals(3.9, $task['time_spent'], 'Total spent', 0.01); + $this->assertEquals(2.75, $task['time_estimated'], 'Total estimated', 0.01); } public function testGetCalendarEvents() -- cgit v1.2.3