Skip to content

Commit

Permalink
Added rank to consultant card, more consultants, experience as a prio…
Browse files Browse the repository at this point in the history
…rity
  • Loading branch information
subhan-nadeem committed Jul 4, 2019
1 parent f885279 commit 17caae5
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 16 deletions.
5 changes: 5 additions & 0 deletions client/src/Card.jsx
Expand Up @@ -15,8 +15,13 @@ class CFCCard extends Component {
variant="top"
src={this.props.consultant.thumbnail? this.props.consultant.thumbnail: "http://fill-image.jobs160.com/300x200"}
/>

<Card.Footer>
<span><b>Rank: </b>{this.props.rank}</span>
</Card.Footer>
<Card.Body>


<Card.Title>{this.props.consultant.name}</Card.Title>
<Card.Subtitle>{this.props.consultant.position ? this.props.consultant.position : "CONSULTANT"}</Card.Subtitle>
<Card.Text>
Expand Down
3 changes: 2 additions & 1 deletion client/src/ConsultantList.jsx
Expand Up @@ -7,8 +7,9 @@ class ConsultantList extends Component {

render() {
return this.props.consultants.map((consultant, i) =>
<CFCCard consultant={consultant}/>
<CFCCard consultant={consultant} rank={i+1}/>
)

}
}

Expand Down
20 changes: 10 additions & 10 deletions server/matching_algorithm.js
@@ -1,10 +1,4 @@
// copy pasted from mock_projects.js because js imports are annoying, fix this later
const PRIORITIES = {
BUDGET: 'Budget',
LOCATION: 'Location',
QUALITY: 'Quality'
};

const projects = require('./mock_projects.js');

// given a project object (see mock_projects.js) and a list of
// consultant objects (see mock_consultants.js), filter the list
Expand All @@ -16,19 +10,25 @@ function filterConsultantsForProject (project, consultants){
console.log(consultants);

switch(project.priority) {
case PRIORITIES.LOCATION:
case projects.PRIORITIES.LOCATION:
console.log(project.location);
consultants = consultants.filter(consultant => consultant.locations.includes(project.locations[0]));
break;
case PRIORITIES.BUDGET:
case projects.PRIORITIES.BUDGET:
consultants = consultants.sort((a, b) => {
return a.pay_amount - b.pay_amount;
});
break;
case PRIORITIES.QUALITY:
case projects.PRIORITIES.QUALITY:
consultants = consultants.sort((a, b) => {
return b.avg_rating - a.avg_rating;
});
break;
case projects.PRIORITIES.EXPERIENCE:
consultants = consultants.sort((a, b) => {
return b.prev_jobs.length - a.prev_jobs.length;
});
break;
}
return consultants
}
Expand Down
30 changes: 29 additions & 1 deletion server/mock_consultants.js
Expand Up @@ -46,7 +46,6 @@ module.exports = {
8.4,
"Hi, my name is Billy Talent! I specialize in the Healthcare industry, specifically in dealing with specialized medical equipment and medicine.",
null

),
new Consultant("Max W.",
"SENIOR CONSULTANT",
Expand Down Expand Up @@ -76,6 +75,35 @@ module.exports = {
"Hi, my name is Danielle Vio! My experiences lie mostly with low income planning assistance and charity event planning",
null
),
new Consultant("Nick C.",
"JUNIOR CONSULTANT",
"https://www.goldenglobes.com/sites/default/files/styles/portrait_medium/public/people/cover_images/20090307_015.jpg",
["Ottawa, ON, Canada", ],
["Animal Care"],
[["01/01/2020", "01/04/2020"], ["01/06/2020", "31/12/2020"]],
10000,
"week",
null,
['00004','00000'],
4,
"Hi, my name is Nick! I specialize as a generalist in the animal care industry.",
null
),
new Consultant("Sam D.",
"SENIOR CONSULTANT",
"https://24celebs.com/public/media/celebrity/2018/10/24/ebyjwjduvkmq-seth-rogen.jpg",
["Sudbury, ON, Canada", ],
["Automotive Repair"],
[["01/01/2020", "01/04/2020"], ["01/06/2020", "31/12/2020"]],
4000,
"week",
null,

['00004','00000', '88888', '55667', '44233', '00023'],
4,
"Hi, my name is Sam! I represent automotive repair non-profits for a living..",
null
),
]
}
}
9 changes: 5 additions & 4 deletions server/mock_projects.js
@@ -1,7 +1,8 @@
const PRIORITIES = {
BUDGET: 'Budget',
LOCATION: 'Location',
QUALITY: 'Quality'
QUALITY: 'Quality',
EXPERIENCE: 'Experience'
};

// create a new mock Project object
Expand Down Expand Up @@ -125,7 +126,7 @@ const projects = {
"To provide meals and other basic supplies to the homeless and other needy persons.",
"Blue Door Soup Kitchns",
null,
PRIORITIES.QUALITY
PRIORITIES.EXPERIENCE
),
'00006': new Project(
'00006',
Expand All @@ -149,6 +150,6 @@ module.exports = {
console.log(projects[projectId])
return projects[projectId]
},

getAllProjects: () => projects
getAllProjects: () => projects,
PRIORITIES
}

0 comments on commit 17caae5

Please sign in to comment.