9
9
* ! The list of environment variables can be found in the config/default.js file
10
10
*
11
11
* Usage:
12
- * $ node group-members-with-skills.js --groupName="Night Owls" --skillProviderName="EMSI"
12
+ * $ node group-members-with-skills.js --groupName="Night Owls" --skillProviderName="EMSI" --attributeGroupName="group 03"
13
13
*
14
14
* where
15
15
* - groupName: Name of the group from which we need to fetch members
16
16
* - skillProviderName: The skill provider name to be used for the skills associated with the members
17
+ * - attributeGroupName: The attribute group name under which the primary attributes are created (isAvailable, location, company and title)
17
18
*/
18
19
19
20
//require('dotenv').config()
@@ -28,7 +29,7 @@ const fs = require('fs')
28
29
29
30
const m2m = m2mAuth ( _ . pick ( config , [ 'AUTH0_URL' , 'AUTH0_AUDIENCE' , 'TOKEN_CACHE_TIME' , 'AUTH0_PROXY_SERVER_URL' ] ) )
30
31
31
- const USAGE = 'node group-members-with-skills.js --groupName="<group_name>" --skillProviderName="<skillprovider_name>". Don\'t forget the quotes for the values.'
32
+ const USAGE = 'node group-members-with-skills.js --groupName="<group_name>" --skillProviderName="<skillprovider_name>" --attributeGroupName="<attribute_group_name>" . Don\'t forget the quotes for the values.'
32
33
33
34
let token
34
35
@@ -230,7 +231,27 @@ async function getMemberSkills (handle) {
230
231
* @param {Array } data Array of objects
231
232
*/
232
233
async function getCSV ( data ) {
233
- const columns = [ 'handle' , 'firstName' , 'lastName' , 'email' , 'isAvailable' , 'company' , 'location' , 'title' , 'skillProviderName' , 'skillName' , 'metricValue' ]
234
+ const columns = [
235
+ 'handle' ,
236
+ 'firstName' ,
237
+ 'lastName' ,
238
+ 'email' ,
239
+ 'skillProviderName' ,
240
+ 'skillName' ,
241
+ 'metricValue' ,
242
+ 'attributeName1' ,
243
+ 'attributeGroupName1' ,
244
+ 'attributeValue1' ,
245
+ 'attributeName1' ,
246
+ 'attributeGroupName2' ,
247
+ 'attributeValue2' ,
248
+ 'attributeName2' ,
249
+ 'attributeGroupName3' ,
250
+ 'attributeValue3' ,
251
+ 'attributeName3' ,
252
+ 'attributeGroupName4' ,
253
+ 'attributeValue4' ,
254
+ ]
234
255
235
256
try {
236
257
const csv = parse ( data , { fields : columns } )
@@ -247,14 +268,17 @@ async function getCSV (data) {
247
268
async function start ( ) {
248
269
const users = [ ]
249
270
const usersWithSkills = [ ]
250
- const { groupName, skillProviderName } = argv
271
+ const { groupName, skillProviderName, attributeGroupName } = argv
251
272
252
273
if ( ! groupName ) {
253
274
console . log ( `Missing group name. Correct usage: ${ USAGE } ` )
254
275
return
255
276
} else if ( ! skillProviderName ) {
256
277
console . log ( `Missing skill provider name. Correct usage: ${ USAGE } ` )
257
278
return
279
+ } else if ( ! attributeGroupName ) {
280
+ console . log ( `Missing attribute group name. Correct usage: ${ USAGE } ` )
281
+ return
258
282
}
259
283
260
284
console . log ( `Searching for id of group named ${ groupName } ...` )
@@ -313,10 +337,18 @@ async function start () {
313
337
firstName : users [ i ] . firstName ,
314
338
lastName : users [ i ] . lastName ,
315
339
email : users [ i ] . email ,
316
- isAvailable : "true" ,
317
- company : "Topcoder" ,
318
- location,
319
- title : "Member" ,
340
+ attributeName1 : 'isAvailable' ,
341
+ attributeGroupName1 : attributeGroupName ,
342
+ attributeValue1 : 'true' ,
343
+ attributeName2 : 'company' ,
344
+ attributeGroupName2 : attributeGroupName ,
345
+ attributeValue2 : 'Topcoder' ,
346
+ attributeName3 : 'location' ,
347
+ attributeGroupName3 : attributeGroupName ,
348
+ attributeValue3 : location ,
349
+ attributeName4 : 'title' ,
350
+ attributeGroupName4 : attributeGroupName ,
351
+ attributeValue4 : 'Member' ,
320
352
skillProviderName,
321
353
skillName : skills [ j ] . name ,
322
354
metricValue : '' + skills [ j ] . score
0 commit comments