diff --git a/commands/commit-count.js b/commands/commit-count.js index f2cd7d8..025487d 100644 --- a/commands/commit-count.js +++ b/commands/commit-count.js @@ -112,7 +112,23 @@ module.exports = { } } - messageMap = new Map([...messageMap.entries()].sort((a, b) => a - b)); + messageMap = new Map([...messageMap.entries()].sort((a, b) => { + if (a[1] == b[1]) { + if (b > a) { + return -1; + } + else if (a < b) { + return 1; + } + return 0; + } + else if (a[1] < b[1]) { + return -1; + } + else { + return 1; + } + })); // Start Commit Checking let validString = ''; @@ -204,7 +220,7 @@ module.exports = { if (validDays.includes(formattedDay)) { dayMap.set(formattedDay, true); } - else if (formattedDay != (monthName + ' ' + (new Date()).getDate().toString().padStart(2, 0))) { + else if (formattedDay != (monthName + ' ' + (new Date()).getDate().toString())) { invalidString += `${formattedDay}\n`; dayMap.set(formattedDay, false); }