From 59cd4f39d4df90032a8eee10d70db93acc6e5bd4 Mon Sep 17 00:00:00 2001 From: Joydip Roy Date: Sun, 5 Aug 2018 00:42:55 +0530 Subject: [PATCH 1/2] fix(#33): reset task nubmer --- lib/render.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/render.js b/lib/render.js index ef1f7d0b..84b042b4 100644 --- a/lib/render.js +++ b/lib/render.js @@ -61,12 +61,10 @@ class Render { return {title, correlation}; } - _buildPrefix(item) { + _buildPrefix(key) { const prefix = []; - - const {_id} = item; - prefix.push(' '.repeat(4 - String(_id).length)); - prefix.push(grey(`${_id}.`)); + prefix.push(' '.repeat(4 - String(key).length)); + prefix.push(grey(`${(key + 1)}.`)); return prefix.join(' '); } @@ -97,12 +95,12 @@ class Render { return log(titleObj); } - _displayItemByBoard(item) { + _displayItemByBoard(item, key) { const {_isTask, isComplete} = item; const age = this._getAge(item._timestamp); const star = this._getStar(item); - const prefix = this._buildPrefix(item); + const prefix = this._buildPrefix(key); const message = this._buildMessage(item); const suffix = (age.length === 0) ? star : `${age} ${star}`; @@ -115,12 +113,12 @@ class Render { return note(msgObj); } - _displayItemByDate(item) { + _displayItemByDate(item, key) { const {_isTask, isComplete} = item; const boards = item.boards.filter(x => x !== 'My Board'); const star = this._getStar(item); - const prefix = this._buildPrefix(item); + const prefix = this._buildPrefix(key); const message = this._buildMessage(item); const suffix = `${this._colorBoards(boards)} ${star}`; @@ -139,11 +137,11 @@ class Render { return; } this._displayTitle(board, items); - items.forEach(item => { + items.forEach((item, key) => { if (item._isTask && item.isComplete && !this._configuration.displayCompleteTasks) { return; } - this._displayItemByBoard(item); + this._displayItemByBoard(item, key); }); }); } @@ -154,11 +152,11 @@ class Render { return; } this._displayTitle(date, items); - items.forEach(item => { + items.forEach((item, key) => { if (item._isTask && item.isComplete && !this._configuration.displayCompleteTasks) { return; } - this._displayItemByDate(item); + this._displayItemByDate(item, key); }); }); } From 010890b541f32a5405c4ccd05609f8b77dfba87d Mon Sep 17 00:00:00 2001 From: Joydip Roy Date: Sun, 5 Aug 2018 11:12:25 +0530 Subject: [PATCH 2/2] fix: display id as prefix of description --- lib/render.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/render.js b/lib/render.js index 84b042b4..3ce679b9 100644 --- a/lib/render.js +++ b/lib/render.js @@ -61,8 +61,9 @@ class Render { return {title, correlation}; } - _buildPrefix(key) { + _buildPrefix(item, key) { const prefix = []; + prefix.push(' '.repeat(4 - String(key).length)); prefix.push(grey(`${(key + 1)}.`)); @@ -96,12 +97,13 @@ class Render { } _displayItemByBoard(item, key) { - const {_isTask, isComplete} = item; + const {_id, _isTask, isComplete} = item; const age = this._getAge(item._timestamp); const star = this._getStar(item); - const prefix = this._buildPrefix(key); - const message = this._buildMessage(item); + const prefix = this._buildPrefix(item, key); + const _idPrefix = `${blue(`${_id}`)}${' '.repeat(4 - String(_id).length)}`; + const message = _idPrefix + ': ' + this._buildMessage(item); const suffix = (age.length === 0) ? star : `${age} ${star}`; const msgObj = {prefix, message, suffix}; @@ -114,12 +116,13 @@ class Render { } _displayItemByDate(item, key) { - const {_isTask, isComplete} = item; + const {_id, _isTask, isComplete} = item; const boards = item.boards.filter(x => x !== 'My Board'); const star = this._getStar(item); - const prefix = this._buildPrefix(key); - const message = this._buildMessage(item); + const prefix = this._buildPrefix(item, key); + const _idPrefix = `${blue(`${_id}`)}${' '.repeat(4 - String(_id).length)}`; + const message = _idPrefix + ': ' + this._buildMessage(item); const suffix = `${this._colorBoards(boards)} ${star}`; const msgObj = {prefix, message, suffix};