1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Working on time tracker

This commit is contained in:
Hillel Coren 2017-09-24 21:44:37 +03:00
parent 27813567b2
commit 5e0f838271
2 changed files with 6 additions and 2 deletions

View File

@ -152,12 +152,14 @@ class TaskRepository extends BaseRepository
} elseif ($data['action'] == 'offline'){
$task->is_running = $data['is_running'] ? 1 : 0;
}
} elseif (isset($data['is_running'])) {
$task->is_running = $data['is_running'] ? 1 : 0;
}
/*
if ($count = count($timeLog)) {
$lastTime = $timeLog[$count - 1];
$task->is_running = count($lastTime) == 2 && $lastTime[1];
$task->is_running = count($lastTime) == 2 && intval($lastTime[1]);
\Log::info('is running: ' . $task->is_running);
}
*/

View File

@ -431,14 +431,16 @@
self.onStartClick = function() {
if (self.isRunning()) {
var data = 'is_running=0&';
var time = self.lastTime();
time.endTime(moment().unix());
} else {
var data = 'is_running=1&';
var time = new TimeModel();
time.startTime(moment().unix());
self.addTime(time);
}
self.save('time_log=' + JSON.stringify(self.times()));
self.save(data + 'time_log=' + JSON.stringify(self.times()));
}
self.listItemState = ko.computed(function() {