Skip to content

Commit 9c31e35

Browse files
authored
Merge pull request #484 from yoution/issue-462
fix: issue topcoder-archive/topcoder-platform-taas-app#462
2 parents abb7346 + c8019b1 commit 9c31e35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/services/TeamService.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ async function getRoleBySkills (skills) {
794794
raw: true
795795
}
796796
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))
798798
if (roles.length > 0) {
799799
let result = _.each(roles, role => {
800800
// role matched skills list
@@ -813,7 +813,10 @@ async function getRoleBySkills (skills) {
813813
}
814814
}
815815
// 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
817820
}
818821

819822
getRoleBySkills.schema = Joi.object()

0 commit comments

Comments
 (0)