Skip to content

fix: taas issue-412 #450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5624,6 +5624,18 @@ components:
isExternalMember:
type: boolean
description: "Is the user external member"
matchedSkills:
type: array
items:
type: string
example: "java"
description: "skills match with the role"
unMatchedSkills:
type: array
items:
type: string
example: "javascript"
description: "skills unmatch with the role"
skillsMatch:
type: number
format: float
Expand Down
5 changes: 4 additions & 1 deletion src/services/TeamService.js
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,11 @@ async function getRoleBySkills (skills) {
const roles = await Role.findAll(queryCriteria)
if (roles.length > 0) {
let result = _.each(roles, role => {
// role matched skills list
role.matchedSkills = _.intersection(role.listOfSkills, skills)
role.unMatchedSkills = _.difference(skills, role.matchedSkills)
// calculate each found roles matching rate
role.skillsMatch = _.intersection(role.listOfSkills, skills).length / skills.length
role.skillsMatch = role.matchedSkills.length / skills.length
// each role can have multiple rates, get the maximum of global rates
role.maxGlobal = _.maxBy(role.rates, 'global').global
})
Expand Down