Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #87 from emceeaich/glitch
Browse files Browse the repository at this point in the history
  • Loading branch information
emceeaich authored Sep 23, 2019
2 parents 6df4314 + 9a1b505 commit fd48a53
Show file tree
Hide file tree
Showing 17 changed files with 600 additions and 1,299 deletions.
4 changes: 0 additions & 4 deletions .gitignore

This file was deleted.

1 change: 1 addition & 0 deletions .glitch-assets
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"LICENSE","date":"2019-09-05T01:19:21.724Z","url":"https://cdn.glitch.com/2eb3294e-3229-4dcb-8fcd-26381ff6f66f%2FLICENSE","type":"","size":16725,"thumbnail":"https://cdn.glitch.com/2eb3294e-3229-4dcb-8fcd-26381ff6f66f%2Fthumbnails%2FLICENSE","thumbnailWidth":210,"thumbnailHeight":210,"uuid":"AQeGh3icYfPXOdNI"}
373 changes: 0 additions & 373 deletions LICENSE

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Use `npm initialize` and `npm run` to start and make a note of the URL returned
## Query string arguments

* **version**: numeric version of Firefox nightly or beta
* **report**: `untriaged`, `affecting`, `to_uplift`, `uplifted`, `fix_or_defer`
* **report**: `untriaged`, `needinfo`, `affecting`, `fix_or_defer`
* **all**: by default, the top 10 components are listed in each section, adding `all` to the query string will list all components

Multiple versions and reports can be specified as comma separated values, ie `?version=59,60&report=untriaged&all`.
Multiple reports can be specified as comma separated values, ie `?report=untriaged,needinfo&all`.
4 changes: 0 additions & 4 deletions modules-local/.jshintrc

This file was deleted.

140 changes: 85 additions & 55 deletions modules-local/generate-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,84 +115,102 @@ var GenerateStats = function(config) {
Count categories
*/

versions.forEach(version => {

var mergedate = version.mergedate;
var betadate = version.betadate;
var versionStr = 'firefox' + version.number;
var queries = [
{name: 'needinfo', title: 'Pending untriaged w/needinfo (defects only)', url: `https://bugzilla.mozilla.org/rest/bug?include_fields=id,summary,status,product,component,creation_time,keywords&chfield=%5BBug%20creation%5D&chfieldfrom=${mergedate}&chfieldto=Now&f2=cf_status_${versionStr}&f3=bug_severity&f4=short_desc&f5=component&f6=keywords&f8=flagtypes.name&limit=0&o2=anyexact&o3=notequals&o4=notsubstring&o5=nowordssubstr&o6=notequals&o8=substring&priority=--${productList}${typeList}&resolution=---&short_desc=%5E%5C%5Bmeta&short_desc_type=notregexp&v2=%3F%2C---%2Caffected&v3=enhancement&v4=%5Bmeta%5D&v5=${exclusionList}&v6=stalled&v8=needinfo`},
{name: 'untriaged', title: 'Pending untriaged w/o needinfo (defects only)', url: `https://bugzilla.mozilla.org/rest/bug?include_fields=id,summary,status,product,component,creation_time,keywords&chfield=%5BBug%20creation%5D&chfieldfrom=${mergedate}&chfieldto=Now&f2=cf_status_${versionStr}&f3=bug_severity&f4=short_desc&f5=component&f6=keywords&f8=flagtypes.name&limit=0&o2=anyexact&o3=notequals&o4=notsubstring&o5=nowordssubstr&o6=notequals&o8=notsubstring&priority=--${productList}${typeList}&resolution=---&short_desc=%5E%5C%5Bmeta&short_desc_type=notregexp&v2=%3F%2C---%2Caffected&v3=enhancement&v4=%5Bmeta%5D&v5=${exclusionList}&v6=stalled&v8=needinfo`},
{name: 'affecting', title:'P1 affecting or may affect (all types)', url: `https://bugzilla.mozilla.org/rest/bug?include_fields=id,summary,status,product,component,creation_time,keywords&f1=bug_severity&f10=CP&f11=component&f2=short_desc&f3=OP&f4=cf_status_${versionStr}&f5=OP&f6=cf_status_${versionStr}&f7=creation_ts&f8=CP&j3=OR&j5=OR&limit=0&o1=notequals&o11=nowordssubstr&o2=notregexp&o4=equals&o6=anywords&o7=greaterthaneq&priority=P1&${productList}&resolution=---&v1=enhancement&v11=${exclusionList}&v2=%5E%5C%5Bmeta&v4=affected&v6=---%2C%3F&v7=${mergedate}`},
{name: 'uplifted', title: 'Uplifted (all types)', url:
`https://bugzilla.mozilla.org/rest/bug?include_fields=id,summary,status,product,component,creation_time,keywords&chfield=cf_status_${versionStr}&chfieldfrom=${betadate}&chfieldto=Now&chfieldvalue=fixed&f2=flagtypes.name&f5=attachments.ispatch&o2=equals&v2=approval-mozilla-beta%2B`, showAll: true},
{name: 'fix_or_defer', title: 'Fix or defer (all types)', url: `https://bugzilla.mozilla.org/rest/bug?include_fields=id,summary,status,product,component,creation_time,keywords&f1=component&f2=cf_status_${versionStr}&n1=1&o1=anywordssubstr&o2=equals&priority=P1${productList}&resolution=---&v1=${exclusionList}&v2=affected`}
];

stats.versions[version.number] = {};

queries.forEach(query => {
requests.push(fetch(query.url)
.then(response => {
if (response.ok)
response.json()
.then(data => {
var buglistAll;
if (query.showAll && query.showAll === true) {
buglistAll = query.buglist;
} else {
buglistAll = query.buglist + productList;
}
var ranks = rankComponents(data.bugs);
stats.versions[version.number][query.name] = {
title: query.title,
count: data.bugs.length,
ages: ranks.ages,
ranks: ranks.ranks
};
});
})
.catch(err => {
console.error(err + ', ' + query.name);
})
);
});
var version = versions[0];
var mergedate = version.mergedate;
var betadate = version.betadate;
var versionStr = 'firefox' + version.number;
var queries = [
{name: 'needinfo', title: 'Pending untriaged w/needinfo (defects only)', url: `https://bugzilla.mozilla.org/rest/bug?include_fields=id,summary,status,product,component,creation_time,keywords&chfield=%5BBug%20creation%5D&chfieldfrom=${mergedate}&chfieldto=Now&f2=cf_status_${versionStr}&f3=bug_severity&f4=short_desc&f5=component&f6=keywords&f8=flagtypes.name&limit=0&o2=anyexact&o3=notequals&o4=notsubstring&o5=nowordssubstr&o6=notequals&o8=substring&priority=--${productList}${typeList}&resolution=---&short_desc=%5E%5C%5Bmeta&short_desc_type=notregexp&v2=%3F%2C---%2Caffected&v3=enhancement&v4=%5Bmeta%5D&v5=${exclusionList}&v6=stalled&v8=needinfo`},
{name: 'untriaged', title: 'Pending untriaged w/o needinfo (defects only)', url: `https://bugzilla.mozilla.org/rest/bug?include_fields=id,summary,status,product,component,creation_time,keywords&chfield=%5BBug%20creation%5D&chfieldfrom=${mergedate}&chfieldto=Now&f2=cf_status_${versionStr}&f3=bug_severity&f4=short_desc&f5=component&f6=keywords&f8=flagtypes.name&limit=0&o2=anyexact&o3=notequals&o4=notsubstring&o5=nowordssubstr&o6=notequals&o8=notsubstring&priority=--${productList}${typeList}&resolution=---&short_desc=%5E%5C%5Bmeta&short_desc_type=notregexp&v2=%3F%2C---%2Caffected&v3=enhancement&v4=%5Bmeta%5D&v5=${exclusionList}&v6=stalled&v8=needinfo`},
{name: 'affecting', title:'P1 affecting or may affect (all types)', url: `https://bugzilla.mozilla.org/rest/bug?include_fields=id,summary,status,product,component,creation_time,keywords&f1=bug_severity&f10=CP&f11=component&f2=short_desc&f3=OP&f4=cf_status_${versionStr}&f5=OP&f6=cf_status_${versionStr}&f7=creation_ts&f8=CP&j3=OR&j5=OR&limit=0&o1=notequals&o11=nowordssubstr&o2=notregexp&o4=equals&o6=anywords&o7=greaterthaneq&priority=P1&${productList}&resolution=---&v1=enhancement&v11=${exclusionList}&v2=%5E%5C%5Bmeta&v4=affected&v6=---%2C%3F&v7=${mergedate}`},
{name: 'fix_or_defer', title: 'Fix or defer (all types)', url: `https://bugzilla.mozilla.org/rest/bug?include_fields=id,summary,status,product,component,creation_time,keywords&f1=component&f2=cf_status_${versionStr}&n1=1&o1=anywordssubstr&o2=equals&priority=P1${productList}&resolution=---&v1=${exclusionList}&v2=affected`}
];

stats.versions[version.number] = {};

var beta_merge_date = new moment(versions[1].mergedate);
var nightly_merge_date = new moment(versions[2].mergedate);

queries.forEach(query => {
requests.push(fetch(query.url)
.then(response => {
if (response.ok)
response.json()
.then(data => {
var buglistAll;
if (query.showAll && query.showAll === true) {
buglistAll = query.buglist;
} else {
buglistAll = query.buglist + productList;
}
var ranks = rankComponents(data.bugs);
stats.versions[version.number][query.name] = {
title: query.title,
count: data.bugs.length,
ages: ranks.ages,
ranks: ranks.ranks,
trains: ranks.trains
};
});
})
.catch(err => {
console.error(err + ', ' + query.name);
})
);
});

function rankComponents(bugs) {
var ages = {};
var trains = {};
var buckets = {};
var ranks = [];
var now = moment.utc();

bugs.forEach(bug => {
// count components

var component = bug.product + "::" + bug.component;

// get age group
var creation = new moment(bug.creation_time);
var age = moment.duration(now.diff(creation)).asWeeks();
var age = moment.duration(now.diff(creation)).asWeeks();
var group;

if (age <= 1) {
group = 'lte_week';
} else if (age <= 4) {
group = 'lte_month';
} else {
group = 'gt_month';
}

if (ages[group]) {
ages[group] ++;
} else {
ages[group] = 1;
}


// get train
var train;

if (creation >= nightly_merge_date) {
train = 'nightly';
} else if (creation >= beta_merge_date) {
train = 'beta';
} else {
train = 'release';
}

if (trains[train]) {
trains[train] ++;
} else {
trains[train] = 1;
}

if (!buckets[component]) {
buckets[component] = {};
buckets[component] = {};
}

if (buckets[component].all) {
buckets[component].all.count ++;
buckets[component].all.bugs.push(bug.id);
Expand All @@ -212,7 +230,16 @@ var GenerateStats = function(config) {
bugs: [bug.id]
};
}


if (buckets[component][train]) {
buckets[component][train].count ++;
buckets[component][train].bugs.push(bug.id);
} else {
buckets[component][train] = {
count: 1,
bugs: [bug.id]
};
}
});

// sort by total of bug older than a week
Expand All @@ -221,19 +248,22 @@ var GenerateStats = function(config) {
var componentName = component.split('\:\:');
ranks.push({
productName: componentName[0], componentName: componentName[1],
component: component,
all: buckets[component].all,
component: component,
lte_week: buckets[component].lte_week || { count: 0, bugs: [] },
lte_month: buckets[component].lte_month || { count: 0, bugs: [] },
gt_month: buckets[component].gt_month || { count: 0, bugs: [] }
gt_month: buckets[component].gt_month || { count: 0, bugs: [] },
nightly: buckets[component].nightly || { count: 0, bugs: [] },
beta: buckets[component].beta || { count: 0, bugs: [] },
release: buckets[component].release || {count: 0, bugs: [] },
all: buckets[component].all
});
});

ranks.sort((a,b) => {
return((b.gt_month.count + b.lte_month.count) - (a.gt_month.count + a.lte_month.count));
});

return { ranks: ranks, ages: ages};
return { ranks: ranks, ages: ages, trains: trains};
}

return Promise.all(requests).then(() => {
Expand Down
Loading

0 comments on commit fd48a53

Please sign in to comment.