mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 16:21:01 -04:00
Working on time tracker
This commit is contained in:
parent
bfa54ae501
commit
db6172318a
@ -115,8 +115,11 @@
|
|||||||
console.log('start w/selected...');
|
console.log('start w/selected...');
|
||||||
} else {
|
} else {
|
||||||
console.log('start w/o selected...');
|
console.log('start w/o selected...');
|
||||||
|
var time = new TimeModel();
|
||||||
|
time.startTime(moment().unix());
|
||||||
var task = new TaskModel();
|
var task = new TaskModel();
|
||||||
task.description(self.filter());
|
task.description(self.filter());
|
||||||
|
task.addTime(time);
|
||||||
self.addTask(task);
|
self.addTask(task);
|
||||||
self.selectedTask(task);
|
self.selectedTask(task);
|
||||||
self.filter('');
|
self.filter('');
|
||||||
@ -210,7 +213,11 @@
|
|||||||
for (var i=0; i<data.length; i++) {
|
for (var i=0; i<data.length; i++) {
|
||||||
self.time_log.push(new TimeModel(data[i]));
|
self.time_log.push(new TimeModel(data[i]));
|
||||||
}
|
}
|
||||||
console.log('self.time_log.length: ' + self.time_log().length);
|
}
|
||||||
|
|
||||||
|
self.addTime = function(time) {
|
||||||
|
console.log(time);
|
||||||
|
self.time_log.push(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.isRunning = ko.computed(function() {
|
self.isRunning = ko.computed(function() {
|
||||||
@ -225,7 +232,7 @@
|
|||||||
self.duration = ko.computed(function() {
|
self.duration = ko.computed(function() {
|
||||||
model.clock(); // bind to the clock
|
model.clock(); // bind to the clock
|
||||||
if (! self.time_log().length) {
|
if (! self.time_log().length) {
|
||||||
return '00:00:00';
|
return '0:00:00';
|
||||||
}
|
}
|
||||||
var time = self.time_log()[0];
|
var time = self.time_log()[0];
|
||||||
var now = new Date().getTime();
|
var now = new Date().getTime();
|
||||||
@ -237,7 +244,6 @@
|
|||||||
self.time_log().forEach(function(time){
|
self.time_log().forEach(function(time){
|
||||||
duration += time.duration();
|
duration += time.duration();
|
||||||
});
|
});
|
||||||
console.log('duration: ' + duration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var duration = moment.duration(duration * 1000);
|
var duration = moment.duration(duration * 1000);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user