From 7440624a5c41268712d02eaa29e050e46fe30ec0 Mon Sep 17 00:00:00 2001 From: Alexander Cucer Date: Wed, 7 Feb 2018 19:04:04 +0200 Subject: [PATCH] Fix logs --- package.json | 2 +- src/remote/redmine.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index f18b09f..b79e6cb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "titime", "productName": "TiTime - Keeping the time for you", - "version": "1.3.0", + "version": "1.3.1", "description": "Tool for Instant Time Tracking", "main": "src/index.js", "scripts": { diff --git a/src/remote/redmine.js b/src/remote/redmine.js index 04f1896..8ef017e 100644 --- a/src/remote/redmine.js +++ b/src/remote/redmine.js @@ -117,9 +117,11 @@ export default class RedmineProvider extends AbstractProvider { const redmine = this.createClient(); await Promise.all(timeToLog.map((payload) => { // eslint-disable-line + const { hours, issue_id, spent_on } = payload; + Logger.info( - `Log ${payload.hours} hours spent on issue ` + - `#${payload.issue_id} on ${payload.spent_on} to Redmine`, + `Log ${hours} hours spent on issue ` + + `#${issue_id} on ${spent_on} to Redmine`, // eslint-disable-line ); return pify(redmine.create_time_entry.bind(redmine))(payload); @@ -187,7 +189,7 @@ export default class RedmineProvider extends AbstractProvider { shouldReport(lastReportTime) { // eslint-disable-line class-methods-use-this if (!lastReportTime) { return true; - } else if (moment().diff(moment.unix(lastReportTime), 'hours') >= 12) { + } else if (moment.unix(lastReportTime).duration().asDays() >= 1) { return true; }