├── .gitignore ├── level1 ├── main.rb ├── output.json ├── README.md └── data.json ├── level3 ├── README.md ├── output.json └── data.json ├── level2 ├── README.md ├── output.json └── data.json ├── level5 └── README.md ├── level4 ├── README.md ├── output.json └── data.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | _main.rb 3 | -------------------------------------------------------------------------------- /level1/main.rb: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | # Your code 4 | -------------------------------------------------------------------------------- /level3/README.md: -------------------------------------------------------------------------------- 1 | # Level 3 2 | 3 | Not all shifts have the same duration. Shifts happening on a saturday or a 4 | sunday last longer and are paid twice the normal fee. 5 | 6 | Adapt the price computation to take these new rules into account. 7 | -------------------------------------------------------------------------------- /level2/README.md: -------------------------------------------------------------------------------- 1 | # Level 2 2 | 3 | A worker is either a `medic` or an `intern` and their shifts are paid 4 | according their status. 5 | 6 | Per shift, a medic is paid 270 € and an intern is paid 126 €. 7 | 8 | Adapt the price computation to take these new rules into account. 9 | -------------------------------------------------------------------------------- /level1/output.json: -------------------------------------------------------------------------------- 1 | { 2 | "workers": [ 3 | { 4 | "id": 1, 5 | "price": 690 6 | }, 7 | { 8 | "id": 2, 9 | "price": 300 10 | }, 11 | { 12 | "id": 3, 13 | "price": 460 14 | }, 15 | { 16 | "id": 4, 17 | "price": 200 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /level2/output.json: -------------------------------------------------------------------------------- 1 | { 2 | "workers": [ 3 | { 4 | "id": 1, 5 | "price": 810 6 | }, 7 | { 8 | "id": 2, 9 | "price": 810 10 | }, 11 | { 12 | "id": 3, 13 | "price": 252 14 | }, 15 | { 16 | "id": 4, 17 | "price": 540 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /level3/output.json: -------------------------------------------------------------------------------- 1 | { 2 | "workers": [ 3 | { 4 | "id": 1, 5 | "price": 270 6 | }, 7 | { 8 | "id": 2, 9 | "price": 810 10 | }, 11 | { 12 | "id": 3, 13 | "price": 630 14 | }, 15 | { 16 | "id": 4, 17 | "price": 810 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /level5/README.md: -------------------------------------------------------------------------------- 1 | # Level 5 2 | 3 | This level is a little bit different: we are now looking for a Rails 4 | application that helps us manage workers and shift. 5 | 6 | We are expecting a link to a hosted Rails application that enable us to: 7 | - Add and edit workers 8 | - Add and assign shifts 9 | - Consult shifts 10 | 11 | The application should be as simple as possible (for example, authentication is 12 | not expected), don't spend too much time on it. 13 | -------------------------------------------------------------------------------- /level4/README.md: -------------------------------------------------------------------------------- 1 | # Level 4 2 | 3 | Our (fictionnal) business model is to price our service 5% on each shift. In 4 | addition to that we also help the hospitals to fill in unassigned shifts with 5 | interim workers. 6 | 7 | An interim is paid 480 € per shift. We also take a fixed fee of 80 € on each 8 | shift for which we provided an interim worker. 9 | 10 | Adapt the price computation to take these new rules into account and to 11 | calculate our commission. 12 | -------------------------------------------------------------------------------- /level4/output.json: -------------------------------------------------------------------------------- 1 | { 2 | "workers": [ 3 | { 4 | "id": 1, 5 | "price": 540 6 | }, 7 | { 8 | "id": 2, 9 | "price": 810 10 | }, 11 | { 12 | "id": 3, 13 | "price": 126 14 | }, 15 | { 16 | "id": 4, 17 | "price": 810 18 | }, 19 | { 20 | "id": 5, 21 | "price": 1920 22 | } 23 | ], 24 | "commission": { 25 | "pdg_fee": 450.30, 26 | "interim_shifts": 3 27 | } 28 | } -------------------------------------------------------------------------------- /level1/README.md: -------------------------------------------------------------------------------- 1 | # Intro 2 | 3 | We are building an online night-shift manager. 4 | Let's call it Planning de Garde :) 5 | 6 | Here is our plan: 7 | - A hospital schedule shifts for all their plannings 8 | - Shift workers manage their shifts 9 | 10 | # Level 1 11 | 12 | Once the hospital has scheduled all shifts, it want to know how much each shift 13 | worker is supposed to be paid. Each shift is paid according to the worker 14 | assigned to the shift. 15 | 16 | Write code that generates `output.json` from `data.json` 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Augment Backend Ruby Challenge 2 | 3 | ## Guidelines 4 | 5 | - Clone this repo (do **not** fork it) 6 | - Solve the levels in ascending order 7 | - Commit your code at the end of each level 8 | - Once you are done, ping someone from Augment 9 | 10 | You can have a look at the higher levels, but please do the **simplest thing** 11 | that could work for the level you're currently solving. 12 | 13 | Disclaimer: the levels become more complex over time, so you will probably have 14 | to re-use some code and adapt it to the new requirements. A good way to solve 15 | this is by using OOP and adding new layers of abstraction only when they become 16 | necessary. Don't hesitate to write [shameless code][1] at first, and then 17 | refactor it in the next levels. 18 | 19 | We are interested in seeing code that is: 20 | - Clean 21 | - Robust 22 | - Tested 23 | - Extensible 24 | 25 | [1]: http://red-badger.com/blog/2014/08/20/i-spent-3-days-with-sandi-metz-heres-what-i-learned/ 26 | -------------------------------------------------------------------------------- /level2/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "workers": [ 3 | { "id": 1, "first_name": "Julie", "status": "medic" }, 4 | { "id": 2, "first_name": "Marc", "status": "medic" }, 5 | { "id": 3, "first_name": "Antoine", "status": "interne" }, 6 | { "id": 4, "first_name": "Emilie", "status": "medic" } 7 | ], 8 | "shifts": [ 9 | { "id": 1, "planning_id": 1, "user_id": 1, "start_date": "2017-1-1" }, 10 | { "id": 2, "planning_id": 1, "user_id": 2, "start_date": "2017-1-2" }, 11 | { "id": 3, "planning_id": 1, "user_id": 3, "start_date": "2017-1-3" }, 12 | { "id": 4, "planning_id": 1, "user_id": 4, "start_date": "2017-1-4" }, 13 | { "id": 5, "planning_id": 1, "user_id": 1, "start_date": "2017-1-5" }, 14 | { "id": 6, "planning_id": 1, "user_id": 2, "start_date": "2017-1-6" }, 15 | { "id": 7, "planning_id": 1, "user_id": 3, "start_date": "2017-1-7" }, 16 | { "id": 8, "planning_id": 1, "user_id": 4, "start_date": "2017-1-8" }, 17 | { "id": 9, "planning_id": 1, "user_id": 1, "start_date": "2017-1-9" }, 18 | { "id": 10, "planning_id": 1, "user_id": 2, "start_date": "2017-1-10" } 19 | ] 20 | } -------------------------------------------------------------------------------- /level3/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "workers": [ 3 | { "id": 1, "first_name": "Julie", "status": "medic" }, 4 | { "id": 2, "first_name": "Marc", "status": "medic" }, 5 | { "id": 3, "first_name": "Antoine", "status": "interne" }, 6 | { "id": 4, "first_name": "Emilie", "status": "medic" } 7 | ], 8 | "shifts": [ 9 | { "id": 1, "planning_id": 1, "user_id": 3, "start_date": "2017-1-1" }, 10 | { "id": 2, "planning_id": 1, "user_id": 2, "start_date": "2017-1-2" }, 11 | { "id": 3, "planning_id": 1, "user_id": 3, "start_date": "2017-1-3" }, 12 | { "id": 4, "planning_id": 1, "user_id": 4, "start_date": "2017-1-4" }, 13 | { "id": 5, "planning_id": 1, "user_id": 1, "start_date": "2017-1-5" }, 14 | { "id": 6, "planning_id": 1, "user_id": 2, "start_date": "2017-1-6" }, 15 | { "id": 7, "planning_id": 1, "user_id": 3, "start_date": "2017-1-7" }, 16 | { "id": 8, "planning_id": 1, "user_id": 4, "start_date": "2017-1-8" }, 17 | { "id": 9, "planning_id": 1, "user_id": null, "start_date": "2017-1-9" }, 18 | { "id": 10, "planning_id": 1, "user_id": 2, "start_date": "2017-1-10" } 19 | ] 20 | } -------------------------------------------------------------------------------- /level1/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "workers": [ 3 | { "id": 1, "first_name": "Julie", "price_per_shift": 230 }, 4 | { "id": 2, "first_name": "Marc", "price_per_shift": 100 }, 5 | { "id": 3, "first_name": "Antoine", "price_per_shift": 230 }, 6 | { "id": 4, "first_name": "Emilie", "price_per_shift": 100 } 7 | ], 8 | "shifts": [ 9 | { "id": 1, "planning_id": 1, "user_id": 1, "start_date": "2017-1-1" }, 10 | { "id": 2, "planning_id": 1, "user_id": 2, "start_date": "2017-1-2" }, 11 | { "id": 3, "planning_id": 1, "user_id": 3, "start_date": "2017-1-3" }, 12 | { "id": 4, "planning_id": 1, "user_id": 4, "start_date": "2017-1-4" }, 13 | { "id": 5, "planning_id": 1, "user_id": 1, "start_date": "2017-1-5" }, 14 | { "id": 6, "planning_id": 1, "user_id": 2, "start_date": "2017-1-6" }, 15 | { "id": 7, "planning_id": 1, "user_id": 3, "start_date": "2017-1-7" }, 16 | { "id": 8, "planning_id": 1, "user_id": 4, "start_date": "2017-1-8" }, 17 | { "id": 9, "planning_id": 1, "user_id": 1, "start_date": "2017-1-9" }, 18 | { "id": 10, "planning_id": 1, "user_id": 2, "start_date": "2017-1-10" } 19 | ] 20 | } -------------------------------------------------------------------------------- /level4/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "workers": [ 3 | { "id": 1, "first_name": "Julie", "status": "medic" }, 4 | { "id": 2, "first_name": "Marc", "status": "medic" }, 5 | { "id": 3, "first_name": "Antoine", "status": "interne" }, 6 | { "id": 4, "first_name": "Emilie", "status": "medic" }, 7 | { "id": 5, "first_name": "Lea", "status": "interim" } 8 | ], 9 | "shifts": [ 10 | { "id": 1, "planning_id": 1, "user_id": 1, "start_date": "2017-1-1" }, 11 | { "id": 2, "planning_id": 1, "user_id": 2, "start_date": "2017-1-2" }, 12 | { "id": 3, "planning_id": 1, "user_id": 3, "start_date": "2017-1-3" }, 13 | { "id": 4, "planning_id": 1, "user_id": 4, "start_date": "2017-1-4" }, 14 | { "id": 5, "planning_id": 1, "user_id": 5, "start_date": "2017-1-5" }, 15 | { "id": 6, "planning_id": 1, "user_id": 2, "start_date": "2017-1-6" }, 16 | { "id": 7, "planning_id": 1, "user_id": 5, "start_date": "2017-1-7" }, 17 | { "id": 8, "planning_id": 1, "user_id": 4, "start_date": "2017-1-8" }, 18 | { "id": 9, "planning_id": 1, "user_id": 5, "start_date": "2017-1-9" }, 19 | { "id": 10, "planning_id": 1, "user_id": 2, "start_date": "2017-1-10" } 20 | ] 21 | } --------------------------------------------------------------------------------