File tree 1 file changed +5
-2
lines changed 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -794,7 +794,7 @@ async function getRoleBySkills (skills) {
794
794
raw : true
795
795
}
796
796
let roles = await Role . findAll ( queryCriteria )
797
- roles = _ . filter ( roles , role => _ . find ( role . rates , r => r . global ) )
797
+ roles = _ . filter ( roles , role => _ . find ( role . rates , r => r . global && r . rate20Global && r . rate30Global ) )
798
798
if ( roles . length > 0 ) {
799
799
let result = _ . each ( roles , role => {
800
800
// role matched skills list
@@ -813,7 +813,10 @@ async function getRoleBySkills (skills) {
813
813
}
814
814
}
815
815
// if no matching role found then return Custom role or empty object
816
- return await Role . findOne ( { where : { name : { [ Op . iLike ] : 'Custom' } } , raw : true } ) || { }
816
+ const customRole = await Role . findOne ( { where : { name : { [ Op . iLike ] : 'Custom' } } , raw : true } ) || { }
817
+ customRole . rates [ 0 ] . rate20Global = customRole . rates [ 0 ] . global * 0.75
818
+ customRole . rates [ 0 ] . rate30Global = customRole . rates [ 0 ] . global * 0.5
819
+ return customRole
817
820
}
818
821
819
822
getRoleBySkills . schema = Joi . object ( )
You can’t perform that action at this time.
0 commit comments