Bauke/tildes-issue-log
Bauke
/
tildes-issue-log
Archived
1
Fork 0

Add most frequent issue creators

This commit is contained in:
Bauke 2018-06-25 00:24:03 +02:00
parent aa1159888f
commit ddeb1e28ff
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 18 additions and 1 deletions

19
main.js
View File

@ -189,6 +189,23 @@ function createStatistics() {
statistics += `The average time to close issues was ${averageClosedDays} days `
statistics += `or ${averageClosedHours} hours.\n\n`
let _mostFrequent = {}
for (const file of opened) {
const issue = require(file.path)
if (typeof _mostFrequent[issue.author.username] === 'undefined') _mostFrequent[issue.author.username] = 1
else _mostFrequent[issue.author.username]++
}
let mostFrequent = Object.keys(_mostFrequent)
mostFrequent.sort((a, b) => _mostFrequent[b] - _mostFrequent[a])
mostFrequent = mostFrequent.slice(0, 3)
statistics += 'Most frequent issue creators:\n\n'
for (const user of mostFrequent) {
statistics += `* [${user}](https://gitlab.com/${user}) `
statistics += `with [${_mostFrequent[user]} issues created](https://gitlab.com/tildes/tildes/issues?state=all&author_username=${user}).\n`
}
let labels = {}
for (const file of opened) {
const issue = require(file.path)
@ -202,7 +219,7 @@ function createStatistics() {
let labelsOrdered = {}
Object.keys(labels).sort().forEach(label => labelsOrdered[label] = labels[label])
statistics += 'Total amount of labels assigned to currently open issues:\n\n'
statistics += '\nTotal amount of labels assigned to currently open issues:\n\n'
for (const label in labelsOrdered) {
statistics += `* [${label}](https://gitlab.com/tildes/tildes/issues?state=opened&label_name%5B%5D=${label.replace(' ', '+')}): ${labels[label]} times.\n`