Be sure to use node 8.11.0, if you'r running another version of node, you could use nvm to work with differents version of node without getting crazy :)
If you have nvm installed
nvm use
Then install node dependencies
npm i
If you run the project like that, you'll get an empty freelance. If you want to test the code with some data, edit the file exercice/freelance.json, you can use the tests/unit/fixtures/freelance.input.json file as an example.
node exercise.js
Or
npm start
npm test
At comet, we handle thousands of freelancers, each freelancers has several professional experiences populated in their profile.
We use these professional experiences in our matching algorithm to match the freelancer with the most relevant experience to the mission.
You can find an example of a mission and of a freelancer data model in the /examples folder.
In our matching algorithm, we use the total months of experience of each skill for each freelancer.
If you look at the example example/freelancer.json, you will see that the freelancer has 3 professional experiences, you can see that he has been doing Javascript since his first professional experience, in may 2013 and kept doing Javascript until his last professional experience in may 2018.
We would like to compute the total number of months the freelancer has worked for each skill.
You will have to read the data from exercise/freelancer.json, it will have the same structure as example/freelancer.json.
The result should be formatted in JSON with this exact structure on the standard output :
{
"freelance": {
"id": 42,
"computedSkills": [
{
"id": 241,
"name": "React",
"durationInMonths": 28
},
{
"id": 270,
"name": "Node.js",
"durationInMonths": 28
},
{
"id": 370,
"name": "Javascript",
"durationInMonths": 60
},
{
"id": 400,
"name": "Java",
"durationInMonths": 40
},
{
"id": 470,
"name": "MySQL",
"durationInMonths": 32
}
]
}
}
- Overlapping months of experience with the same skill(s) should not be counted twice, see assets/months-overlap.png
- All professional experiences
startDateandendDatevalues will be on the first day of the month. - You script will be executed like this :
node exercise.js - We're using node 8.11.3 for the execution
- You can use any npm package you want
- If there's an error in the json file, exit without printing anything
- The duration in months should be rounded
- Cleanliness & structure of the code
- Problem solving
- Documentation
- Use of tests
- Smart use of Node.js library and packages
- Respect of KISS and DRY principles
- Use of git commits
- Fork the repo or clone it if you don't have a Github account
- Do the exercise
- Give us your fork URL or send us an archive file containing your work