Skip to content

Commit c7f3b67

Browse files
author
Andreas Müller
committed
use notes api to push spend times and spend date
1 parent ec5ca47 commit c7f3b67

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/include/tasks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class tasks {
117117
return new Promise((resolve, reject) => {
118118
let resource = this.sync.resources[frame.resource.type][frame.resource.id];
119119

120-
resource.createTime(Math.ceil(time))
120+
resource.createTime(Math.ceil(time), frame._stop)
121121
.then(() => resource.getNotes())
122122
.then(() => {
123123
if (frame.resource.new) {

src/models/hasTimes.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ class hasTimes extends Base {
2222
* @param time
2323
* @returns {*}
2424
*/
25-
createTime(time) {
26-
return this.post(`projects/${this.data.project_id}/${this._type}/${this.iid}/add_spent_time`, {
27-
duration: Time.toHumanReadable(time, this.config.get('hoursPerDay'), '[%sign][%days>d ][%hours>h ][%minutes>m ][%seconds>s]')
25+
createTime(time, created_at) {
26+
var date = new Date(created_at);
27+
var spentAt = date.getUTCFullYear()+"-"+date.getUTCMonth()+"-"+date.getUTCDate();
28+
return this.post(`projects/${this.data.project_id}/${this._type}/${this.iid}/notes`, {
29+
body: '/spend '+Time.toHumanReadable(time, this.config.get('hoursPerDay'), '[%sign][%days>d ][%hours>h ][%minutes>m ][%seconds>s]'+' '+spentAt),
2830
});
2931
}
3032

0 commit comments

Comments
 (0)