1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

Working on the time tracker

This commit is contained in:
Hillel Coren 2017-10-01 20:09:53 +03:00
parent f20956732a
commit fc624d1aab

View File

@ -983,7 +983,7 @@
duration = Math.floor(duration / 100) / 10; duration = Math.floor(duration / 100) / 10;
} else { } else {
self.time_log().forEach(function(time){ self.time_log().forEach(function(time){
duration += time.duration(); duration += time.duration.running();
}); });
} }
@ -1173,6 +1173,19 @@
}); });
self.duration = ko.computed({ self.duration = ko.computed({
read: function () {
model.clock(); // bind to the clock
if (! self.startTime() || ! self.endTime()) {
return false;
}
return self.endTime() - self.startTime();
},
write: function(value) {
self.endTime(self.startTime() + value);
}
});
self.duration.running = ko.computed({
read: function () { read: function () {
model.clock(); // bind to the clock model.clock(); // bind to the clock
if (! self.startTime()) { if (! self.startTime()) {
@ -1185,6 +1198,8 @@
self.endTime(self.startTime() + value); self.endTime(self.startTime() + value);
} }
}); });
} }
</script> </script>