Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit 65b5f16

Browse files
Correct issue where column names for primary attributes were not correct
1 parent e57b6b4 commit 65b5f16

File tree

1 file changed

+40
-8
lines changed

1 file changed

+40
-8
lines changed

group-members-with-skills.js

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
* ! The list of environment variables can be found in the config/default.js file
1010
*
1111
* 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"
1313
*
1414
* where
1515
* - groupName: Name of the group from which we need to fetch members
1616
* - 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)
1718
*/
1819

1920
//require('dotenv').config()
@@ -28,7 +29,7 @@ const fs = require('fs')
2829

2930
const m2m = m2mAuth(_.pick(config, ['AUTH0_URL', 'AUTH0_AUDIENCE', 'TOKEN_CACHE_TIME', 'AUTH0_PROXY_SERVER_URL']))
3031

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.'
3233

3334
let token
3435

@@ -230,7 +231,27 @@ async function getMemberSkills (handle) {
230231
* @param {Array} data Array of objects
231232
*/
232233
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+
]
234255

235256
try {
236257
const csv = parse(data, { fields: columns })
@@ -247,14 +268,17 @@ async function getCSV (data) {
247268
async function start () {
248269
const users = []
249270
const usersWithSkills = []
250-
const { groupName, skillProviderName } = argv
271+
const { groupName, skillProviderName, attributeGroupName } = argv
251272

252273
if (!groupName) {
253274
console.log(`Missing group name. Correct usage: ${USAGE}`)
254275
return
255276
} else if (!skillProviderName) {
256277
console.log(`Missing skill provider name. Correct usage: ${USAGE}`)
257278
return
279+
} else if (!attributeGroupName) {
280+
console.log(`Missing attribute group name. Correct usage: ${USAGE}`)
281+
return
258282
}
259283

260284
console.log(`Searching for id of group named ${groupName}...`)
@@ -313,10 +337,18 @@ async function start () {
313337
firstName: users[i].firstName,
314338
lastName: users[i].lastName,
315339
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',
320352
skillProviderName,
321353
skillName: skills[j].name,
322354
metricValue: '' + skills[j].score

0 commit comments

Comments
 (0)