JavaScript workshop based on the french startup https://www.govirtuo.com
Table of Contents
- 🐣 Introduction
- 🎯 Objectives
- 👩💻 Just tell me what to do
- 🏃♀️ Steps to do
- Source and inspiration
- Licence
Virtuo is a French start-up that digitizes the car rental industry across Europe via a Web Application.
The Rental car market is a key sector of the Europe economy:
- 54 billion euros Worldwide in revenue (prediction for 2020)
- 1 billion euros in France in revenue (prediction for 2020)
- Historically time consuming: wasted queuing for the rental desk, paperwork nor pre-rental inspection...
Virtuo is a trusted third party between the premium partners like BMW or Mercedes and the drivers. The application allows:
- the drivers to find a car 24/7
- the drivers to book with an one-click a car for a given period
- the drivers to unlock cars with a seamless mobile-only experience
- the premium partners to maximize their rental rate and therefore the revenue of their business
We focus on this application feature: to book with an one-click a car for a given period
.
The workshop goals are to
- compute the rental price of the
driver
- compute the profit of the
partner
- compute the profit of
virtuo
- Be sure to have a GitHub account.
If not, you should create a GitHub account then add your ssh to your github profile for a better authentication.
- Fork the project via
github
- Clone your forked repository project
https://github.com/YOUR_USERNAME/virtuo
❯ cd /path/to/workspace
❯ git clone [email protected]:YOUR_USERNAME/virtuo.git
- Open the entry point /public/index.html in your browser (that loads the
index.js
file)
# macos cli
❯ open public/index.html
# linux cli
❯ xdg-open public/index.html
# or by double-clicking in your browser files
- Check the ouput in your browser console (Use
Ctrl + Shift + J
orCmd + Opt + J
to focus to your console devtools) - Solve each steps inside ./public/index.js file with JavaScript
- Once a step is solved, commit your modification:
❯ cd /path/to/workspace/virtuo
❯ git add -A && git commit -m "feat(price): decrease pricing according days"
(why following a commit message convention?
- 5 steps, so ideally 5 commits
- Don't forget to push before the end of the workshop
❯ git push origin master
Note: if you catch an error about authentication, add your ssh to your github profile.
- Check that your codebase works by checking the console output
- If you need some helps on git commands, read git - the simple guide
- DRY - Don't repeat yourself
- DOT - Do One Thing
- KISS - Keep It Simple Stupid
- LIM - Less Is More
- English only: codebase, variables, comments...
Focus only on coding, forgot the browser display (next workshop!).
Use console.log
to display results (for the moment)
The driver
books a car for a specific time range and an approximate distance.
The rental price is the sum of the time component and the distance component with
- time component: the number of rental days multiplied by the
car
price per day - distance component: the number of kilometers multiplied by the
car
s price per km
rental price = time + distance
Write JS code that generates the rental price for each driver
from index.js
file:
To be as competitive as possible, Virtuo
decide to have a decreasing pricing for longer rentals.
price per people
- decreases by 10% after 1 day
- decreases by 30% after 4 days
- decreases by 50% after 10 days
Adapt the rental price computation to take these new rules into account.
Now, it's time to pay Virtuo
There is a 30% commission on the rental price to cover the costs.
The commission is split like this:
- insurance: half of commission
- the Treasury: 1€ by day
- Virtuo: the rest
Compute the amount that belongs to the insurance
, to the Treasury
and to Virtuo
.
In case of an accident/theft, Virtuo
applies a 5000€ deductible.
The driver can reduce the deductible amount from 5000€ to 500€ with a deductible option
for a few more euros per day.
The driver is charged an additional 4€/day when he chooses the deductible reduction
option.
The additional charge goes to Virtuo
, not to the partner.
Compute the new rental price if the driver subscribed to deductible option
.
It's time to debit/credit each actor!
- the driver must pay the rental price and the (optional) deductible reduction
- the partner receives the rental price minus the commission
- the insurance receives its part of the commission
- the Treasury receives its part of the tax commission
- Virtuo receives its part of the commission, plus the deductible reduction
- Compute the debit for the
driver
- Compute the credit of the
partner
,insurance
,Treasury
andVirtuo
.