Add most frequent issue creators
This commit is contained in:
parent
aa1159888f
commit
ddeb1e28ff
19
main.js
19
main.js
|
@ -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`
|
||||
|
|
Reference in New Issue