Skip to content

Instantly share code, notes, and snippets.

@nmondollot
Last active December 23, 2015 12:39
Show Gist options
  • Save nmondollot/6637213 to your computer and use it in GitHub Desktop.
Save nmondollot/6637213 to your computer and use it in GitHub Desktop.
# Drivy backend test
## Context
Let's consider a problem we encountered at Drivy that can go pretty deep and can be quite complex : car availability.
A car owner can fill out a calendar to let other users know when his car is available :
![calendar](http://f.cl.ly/items/0y1X0G0M3y3F2d1k0t3p/Capture%20d%E2%80%99%C3%A9cran%202013-09-20%20%C3%A0%2012.00.08.png)
Drivers who want to rent a car on Drivy want to know if a car is available for a given period (i.e. between two dates)
eg. is the car available from oct 24th to oct 26th ? (in our example, the answer is no)
Drivy admins want to do some reporting about car availability. They want to know the availability rate of a car for a given month. For instance if a car is available 3 days out of the 30 of a given month, its availability rate is 10%.
## Todo
Implement a calendar object for one car. It should be possible to :
- Set the availability status for a given date or period
- Ask if the car is available for a given period
- Ask the car availability rate for a given month
Focus only on the backend side (i.e. models). No UI is needed.
You can use database-backed models, but it’s not mandatory.
Everything should be tested. We are not expecting a full and perfect test suite, but there should be some tests.
## Time Limit
We would expect someone to complete this in a few hours.
However at the end, we would like you to tell us how much time you spent on each part of the problem, so please try to keep track of this.
## What we will be looking for
We'll run the project and see if it works, but we'll pay even more attention to :
- Your understanding of the problem
- The general code quality and comprehensiveness
- The object oriented architecture you decide on
## Tools
You have to work with:
- Ruby 2.0 (we'll run it with 2.0.0p247 to be precise)
- Rails 3/4, if you decide you need it. POROs are fine too.
- If you chose a database, please stay with sqlite, mysql or redis
- Git
Aside from this, feel free to use anything you want. Don't hesitate to use gems to help you along, but do not use a gem that already does exactly what is asked (i.e. use mysql2, yaml, ap … don't use my_awesome_availibility_gem).
## Too Easy ?
This part is not required, and we prefer a perfect project that is small and focused than a large project that doesn't work properly. I can't stress that enough, the important thing here is to get the first part right.
With that in mind, if you want to take it to the next level because you blazed through the first implementation and feel like coding some more, here are some things that we would like to see:
- Implement this for multiple cars
- Build a very basic interface using Rails
- Create a product around this and get VC funding (8M minimum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment