@@ -115,84 +115,102 @@ var GenerateStats = function(config) {
115
115
Count categories
116
116
*/
117
117
118
- versions . forEach ( version => {
119
-
120
- var mergedate = version . mergedate ;
121
- var betadate = version . betadate ;
122
- var versionStr = 'firefox' + version . number ;
123
- var queries = [
124
- { 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` } ,
125
- { 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 ` } ,
126
- { 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 } ` } ,
127
- { name : 'uplifted' , title : 'Uplifted (all types)' , url :
128
- `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 } ,
129
- { 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` }
130
- ] ;
131
-
132
- stats . versions [ version . number ] = { } ;
133
-
134
- queries . forEach ( query => {
135
- requests . push ( fetch ( query . url )
136
- . then ( response => {
137
- if ( response . ok )
138
- response . json ( )
139
- . then ( data => {
140
- var buglistAll ;
141
- if ( query . showAll && query . showAll === true ) {
142
- buglistAll = query . buglist ;
143
- } else {
144
- buglistAll = query . buglist + productList ;
145
- }
146
- var ranks = rankComponents ( data . bugs ) ;
147
- stats . versions [ version . number ] [ query . name ] = {
148
- title : query . title ,
149
- count : data . bugs . length ,
150
- ages : ranks . ages ,
151
- ranks : ranks . ranks
152
- } ;
153
- } ) ;
154
- } )
155
- . catch ( err => {
156
- console . error ( err + ', ' + query . name ) ;
157
- } )
158
- ) ;
159
- } ) ;
118
+ var version = versions [ 0 ] ;
119
+ var mergedate = version . mergedate ;
120
+ var betadate = version . betadate ;
121
+ var versionStr = 'firefox' + version . number ;
122
+ var queries = [
123
+ { 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` } ,
124
+ { 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` } ,
125
+ { 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 } ` } ,
126
+ { 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` }
127
+ ] ;
128
+
129
+ stats . versions [ version . number ] = { } ;
130
+
131
+ var beta_merge_date = new moment ( versions [ 1 ] . mergedate ) ;
132
+ var nightly_merge_date = new moment ( versions [ 2 ] . mergedate ) ;
133
+
134
+ queries . forEach ( query => {
135
+ requests . push ( fetch ( query . url )
136
+ . then ( response => {
137
+ if ( response . ok )
138
+ response . json ( )
139
+ . then ( data => {
140
+ var buglistAll ;
141
+ if ( query . showAll && query . showAll === true ) {
142
+ buglistAll = query . buglist ;
143
+ } else {
144
+ buglistAll = query . buglist + productList ;
145
+ }
146
+ var ranks = rankComponents ( data . bugs ) ;
147
+ stats . versions [ version . number ] [ query . name ] = {
148
+ title : query . title ,
149
+ count : data . bugs . length ,
150
+ ages : ranks . ages ,
151
+ ranks : ranks . ranks ,
152
+ trains : ranks . trains
153
+ } ;
154
+ } ) ;
155
+ } )
156
+ . catch ( err => {
157
+ console . error ( err + ', ' + query . name ) ;
158
+ } )
159
+ ) ;
160
160
} ) ;
161
161
162
162
function rankComponents ( bugs ) {
163
163
var ages = { } ;
164
+ var trains = { } ;
164
165
var buckets = { } ;
165
166
var ranks = [ ] ;
166
167
var now = moment . utc ( ) ;
167
-
168
+
168
169
bugs . forEach ( bug => {
169
170
// count components
170
171
171
172
var component = bug . product + "::" + bug . component ;
172
-
173
+
173
174
// get age group
174
175
var creation = new moment ( bug . creation_time ) ;
175
- var age = moment . duration ( now . diff ( creation ) ) . asWeeks ( ) ;
176
+ var age = moment . duration ( now . diff ( creation ) ) . asWeeks ( ) ;
176
177
var group ;
177
-
178
+
178
179
if ( age <= 1 ) {
179
180
group = 'lte_week' ;
180
181
} else if ( age <= 4 ) {
181
182
group = 'lte_month' ;
182
183
} else {
183
184
group = 'gt_month' ;
184
185
}
185
-
186
+
186
187
if ( ages [ group ] ) {
187
188
ages [ group ] ++ ;
188
189
} else {
189
190
ages [ group ] = 1 ;
190
191
}
191
-
192
+
193
+ // get train
194
+ var train ;
195
+
196
+ if ( creation >= nightly_merge_date ) {
197
+ train = 'nightly' ;
198
+ } else if ( creation >= beta_merge_date ) {
199
+ train = 'beta' ;
200
+ } else {
201
+ train = 'release' ;
202
+ }
203
+
204
+ if ( trains [ train ] ) {
205
+ trains [ train ] ++ ;
206
+ } else {
207
+ trains [ train ] = 1 ;
208
+ }
209
+
192
210
if ( ! buckets [ component ] ) {
193
- buckets [ component ] = { } ;
211
+ buckets [ component ] = { } ;
194
212
}
195
-
213
+
196
214
if ( buckets [ component ] . all ) {
197
215
buckets [ component ] . all . count ++ ;
198
216
buckets [ component ] . all . bugs . push ( bug . id ) ;
@@ -212,7 +230,16 @@ var GenerateStats = function(config) {
212
230
bugs : [ bug . id ]
213
231
} ;
214
232
}
215
-
233
+
234
+ if ( buckets [ component ] [ train ] ) {
235
+ buckets [ component ] [ train ] . count ++ ;
236
+ buckets [ component ] [ train ] . bugs . push ( bug . id ) ;
237
+ } else {
238
+ buckets [ component ] [ train ] = {
239
+ count : 1 ,
240
+ bugs : [ bug . id ]
241
+ } ;
242
+ }
216
243
} ) ;
217
244
218
245
// sort by total of bug older than a week
@@ -221,19 +248,22 @@ var GenerateStats = function(config) {
221
248
var componentName = component . split ( '\:\:' ) ;
222
249
ranks . push ( {
223
250
productName : componentName [ 0 ] , componentName : componentName [ 1 ] ,
224
- component : component ,
225
- all : buckets [ component ] . all ,
251
+ component : component ,
226
252
lte_week : buckets [ component ] . lte_week || { count : 0 , bugs : [ ] } ,
227
253
lte_month : buckets [ component ] . lte_month || { count : 0 , bugs : [ ] } ,
228
- gt_month : buckets [ component ] . gt_month || { count : 0 , bugs : [ ] }
254
+ gt_month : buckets [ component ] . gt_month || { count : 0 , bugs : [ ] } ,
255
+ nightly : buckets [ component ] . nightly || { count : 0 , bugs : [ ] } ,
256
+ beta : buckets [ component ] . beta || { count : 0 , bugs : [ ] } ,
257
+ release : buckets [ component ] . release || { count : 0 , bugs : [ ] } ,
258
+ all : buckets [ component ] . all
229
259
} ) ;
230
260
} ) ;
231
261
232
262
ranks . sort ( ( a , b ) => {
233
263
return ( ( b . gt_month . count + b . lte_month . count ) - ( a . gt_month . count + a . lte_month . count ) ) ;
234
264
} ) ;
235
265
236
- return { ranks : ranks , ages : ages } ;
266
+ return { ranks : ranks , ages : ages , trains : trains } ;
237
267
}
238
268
239
269
return Promise . all ( requests ) . then ( ( ) => {
0 commit comments