@@ -874,10 +874,12 @@ async function getSkillsByJobDescription (data) {
874
874
} )
875
875
} )
876
876
foundSkills = _ . uniq ( foundSkills )
877
+ const skillIds = await getSkillIdsByNames ( foundSkills )
877
878
// apply desired template
878
- _ . each ( foundSkills , skill => {
879
+ _ . each ( foundSkills , ( skillTag , idx ) => {
879
880
result . push ( {
880
- tag : skill ,
881
+ id : skillIds [ idx ] ,
882
+ tag : skillTag ,
881
883
type : 'taas_skill' ,
882
884
source : 'taas-jd-parser'
883
885
} )
@@ -933,12 +935,12 @@ getSkillNamesByIds.schema = Joi.object()
933
935
* @returns {Array<string> } the array of skill ids
934
936
*/
935
937
async function getSkillIdsByNames ( skills ) {
936
- const result = await helper . getAllTopcoderSkills ( { name : _ . join ( skills , ',' ) } )
938
+ const tcSkills = await helper . getAllTopcoderSkills ( { name : _ . join ( skills , ',' ) } )
937
939
// endpoint returns the partial matched skills
938
940
// we need to filter by exact match case insensitive
939
- const filteredSkills = _ . filter ( result , tcSkill => _ . some ( skills , skill => _ . toLower ( skill ) === _ . toLower ( tcSkill . name ) ) )
940
- const skillIds = _ . map ( filteredSkills , 'id' )
941
- return skillIds
941
+ // const filteredSkills = _.filter(result, tcSkill => _.some(skills, skill => _.toLower(skill) === _.toLower(tcSkill.name)))
942
+ const matchedSkills = _ . map ( skills , skillTag => tcSkills . find ( tcSkill => _ . toLower ( skillTag ) === _ . toLower ( tcSkill . name ) ) )
943
+ return _ . map ( matchedSkills , 'id' )
942
944
}
943
945
944
946
getSkillIdsByNames . schema = Joi . object ( )
@@ -1051,6 +1053,7 @@ async function createTeam (currentUser, data) {
1051
1053
numPositions : position . numberOfResources ,
1052
1054
rateType : position . rateType ,
1053
1055
workload : position . workload ,
1056
+ hoursPerWeek : position . hoursPerWeek ,
1054
1057
skills : roleSearchRequest . skills ,
1055
1058
description : roleSearchRequest . jobDescription ,
1056
1059
roleIds : [ roleSearchRequest . roleId ] ,
@@ -1083,6 +1086,7 @@ createTeam.schema = Joi.object()
1083
1086
startMonth : Joi . date ( ) ,
1084
1087
rateType : Joi . rateType ( ) . default ( 'weekly' ) ,
1085
1088
workload : Joi . workload ( ) . default ( 'full-time' ) ,
1089
+ hoursPerWeek : Joi . number ( ) . integer ( ) . positive ( ) ,
1086
1090
resourceType : Joi . string ( )
1087
1091
} ) . required ( )
1088
1092
) . required ( )
0 commit comments