Fix bug task estimate is reseted when using subtask timer

This commit is contained in:
Frederic Guillot 2015-08-12 22:17:01 -04:00
parent 94abf4f4d6
commit 8d43897e26
5 changed files with 24 additions and 22 deletions

View File

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

View File

@ -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();
}
/**

View File

@ -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",

26
composer.lock generated
View File

@ -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": "*",

View File

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