Skip to content

Instantly share code, notes, and snippets.

@emceeaich
Last active March 17, 2018 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emceeaich/398e72ccd807a12c20bc795c09ed0fd4 to your computer and use it in GitHub Desktop.
Save emceeaich/398e72ccd807a12c20bc795c09ed0fd4 to your computer and use it in GitHub Desktop.
Counting open bugs inactive over 1, 2, 4, and 10 years in Bugzilla
function countOpen(period, last, total) {
fetch(`https://bugzilla.mozilla.org/rest/bug?include_fields=id,summary,status&f1=days_elapsed&f2=bug_id&limit=0&o1=greaterthan&o2=greaterthan&product=Core&product=External%20Software%20Affecting%20Firefox&product=Firefox&product=Firefox%20for%20Android&product=Firefox%20for%20iOS&product=NSPR&product=NSS&product=Toolkit&resolution=---&v1=${period}&v2=${last}`)
.then(res => { return res.json() })
.then(body => {
var found = body.bugs.length;
total += found;
if (found > 9999) {
body.bugs.sort((a, b) => { a.id - b.id; });
last = body.bugs[found - 1].id;
console.log(`\t\tStill counting, running total is ${total} last is: ${last}.`)
countOpen(period, last, total);
} else {
console.log(`Found ${total} open bugs for ${period} days.`)
}
})
}
countOpen(365, 0, 0);
countOpen(365*2, 0, 0);
countOpen(365*4, 0, 0);
countOpen(365*10, 0, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment