Open pdehaan opened 4 years ago
Basic proof of concept, but calculate the average age of issues by figuring out their cumulative age (from created_at
date) and dividing by the total number of currently open issues:
function issueStats(issues, now = new Date()) {
const totalAgeMs = issues.reduce((totalMs, {created_at}) => totalMs + (now - new Date(created_at)), 0);
const avgAgeMs = totalAgeMs / issues.length;
return {
avgAgeMs,
avgAge: ms(avgAgeMs),
issueCount: issues.length
};
}
That should give us something similar to the following output:
{
"owner": "mozilla",
"repo": "blurts-server",
"date": "2020-03-31",
"now": "2020-04-01T00:04:38.245Z",
"issueStats": {
"avgAgeMs": 22938489197.606636,
"avgAge": "265d",
"issueCount": 211
},
...
}
Silly numbers like "265d" are notoriously tricky to work with in real life (since you don't always know the duration to expect), so maybe we convert to "ms" friendly times on the front end instead of in the data.
I guess worth noting is that I don't suppose Bugzilla has a concept of "pull requests", so that might only be for GitHub repos.
What are they? What do we care about? How to you measure quality or "health"?
Random thoughts in random order (but numbers are easier to reference than bullets)...