Skip to content

Commit

Permalink
Added proper location sorting instead of filtering to matching algo
Browse files Browse the repository at this point in the history
  • Loading branch information
subhan-nadeem committed Jul 25, 2019
1 parent 925852e commit 3a6602f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/matching_algorithm.js
Expand Up @@ -9,7 +9,9 @@ function filterConsultantsForProject (project, consultants){
switch(project.priority) {

case projects.PRIORITIES.LOCATION:
consultants = consultants.filter(consultant => consultant.locations.includes(project.locations[0]));
consultants = consultants.sort((a,b) => {
return a.locations.includes(project.locations[0]) ? -1 : 1;
});
break;
case projects.PRIORITIES.BUDGET:
consultants = consultants.sort((a, b) => {
Expand Down

0 comments on commit 3a6602f

Please sign in to comment.