Giter Site home page Giter Site logo

92bondstreet / privateaser Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 120.0 1.91 MB

JavaScript workshop based on the french startup https://www.privateaser.com

Home Page: https://esilv-privateaser.now.sh

HTML 46.32% JavaScript 36.59% Makefile 13.09% CSS 4.00%

privateaser's Introduction

PRIVATEASER

JavaScript workshop based on the french startup https://www.privateaser.com

privateaser

Table of Contents generated with DocToc

๐Ÿฃ Introduction

Privateaser is a marketplace that digitizes the world of event planning for bars, restaurants and venues (+3,000 locations), via a web application.

The Event management is a key sector of the Europe economy:

  • 100 billion euros in Europe
  • 20 billion euros in France
  • historically complex
  • not much digitized: you have to pick up your phone, wait to be called back, go to visit

Privateaser is a trusted third party between the bars and the bookers. The marketplace allows them to:

  • the bookers to find, to compare or to contact a place
  • the bookers to book with an one-click a place for an event
  • the bookers to manage all their events expenses
  • the managers to maximize the occupancy rate and therefore the revenue of their business

๐ŸŽฏ Objectives

We focus on this marketplace feature: to book with an one-click a place for an event.

The workshop goals are to

  1. compute the booking price of the booker
  2. compute the profit of the bar
  3. compute the profit of privateaser

๐Ÿ‘ฉโ€๐Ÿ’ป Just tell me what to do

  1. Fork the project via github

fork

  1. Clone your forked repository project https://github.com/YOUR_USERNAME/privateaser
โฏ cd /path/to/workspace
โฏ git clone [email protected]:YOUR_USERNAME/privateaser.git
  1. 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
  1. Check the ouput in your browser console (Use Ctrl + Shift + J or Cmd + Opt + J to focus to your console devtools)
  2. Solve each steps inside ./public/index.js file with JavaScript
  3. Once a step is solved, commit your modification:
โฏ cd /path/to/workspace/privateaser
โฏ git add -A && git commit -m "feat(price): decrease pricing according people"

(why following a commit message convention?

  1. 5 steps, so ideally 5 commits
  2. 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.

  1. Check that your codebase works by checking the console output
  2. If you need some helps on git commands, read git - the simple guide

Don't forget:

  • 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)

๐Ÿƒโ€โ™€๏ธ Steps to do

โŒš Step 1 - Euro-People

Booking price

The booker books a place for an specific time range and a set of persons.

The booking price is the sum of the time component and the people component with

  • time component: the number of booked time multiplied by the bar price per hour
  • people component: the number of persons multiplied by the bar price per person
booking price = time + people

Just tell me what to do

Write JS code that generates the booking price for each booker from index.js file:

//example output from console.log
[
  {
    "id": "bba9500c-fd9e-453f-abf1-4cd8f52af377",
    ...
    "price": ?
  },
  {
    "id": "65203b0a-a864-4dea-81e2-e389515752a8",
    ...
    "price": ?
  },
  {
    "id": "94dab739-bd93-44c0-9be1-52dd07baa9f6",
    ...
    "price": ?
  }
]

๐Ÿบ Step 2 - Send more, pay less

Decreasing pricing for people

To be as competitive as possible, Privateaser decide to have a decreasing pricing for groups of important people

New price rules

price per people

  • decreases by 10% after 10 persons
  • decreases by 30% after 20 persons
  • decreases by 50% after 60 persons

Just tell me what to do

Adapt the booking price computation to take these new rules into account.

//example output from console.log
[
  {
    "id": "bba9500c-fd9e-453f-abf1-4cd8f52af377",
    ...
    "price": ?
  },
  {
    "id": "65203b0a-a864-4dea-81e2-e389515752a8",
    ...
    "price": ?
  },
  {
    "id": "94dab739-bd93-44c0-9be1-52dd07baa9f6",
    ...
    "price": ?
  }
]

๐Ÿ’ฐ Step 3 - Give me all your money

Now, it's time to pay the bar

There is a 30% commission on the booking price to cover the costs.

Commission

The commission is split like this:

  • insurance: half of commission
  • the Treasury: 1โ‚ฌ by person
  • Privateaser: the rest

Just tell me what to do

Compute the amount that belongs to the insurance, to the Treasury and to Privateaser.

//example output from console.log
[
  {
    "id": "bba9500c-fd9e-453f-abf1-4cd8f52af377",
    ...
    "commission": {
      "insurance": ?,
      "treasury": ?
      "privateaser": ?
    }
  },
  ...
]

๐Ÿ’ธ Step 4 - The famous deductible

In case of an accident/theft, Privateaser applies a 5000โ‚ฌ deductible.

The booker can reduce the deductible amount from 5000โ‚ฌ to 200โ‚ฌ with a deductible option for a few more euros per person.

The deductible

The booker is charged an additional 1โ‚ฌ/person when he chooses the deductible reduction option.

The additional charge goes to Privateaser, not to the bar.

Just tell me what to do

Compute the new amount price if the booker subscribed to deductible option.

//example output from console.log
[
  {
    "id": "bba9500c-fd9e-453f-abf1-4cd8f52af377",
    'options': {
      'deductibleReduction': true
    },
    ...
    "price": ?
  },
  ...
]

๐Ÿ’ณ Step 5 - Pay the actors

The actors

It's time to debit/credit each actor!

  • the booker must pay the booking price and the (optional) deductible reduction
  • the bar receives the booking price minus the commission
  • the insurance receives its part of the commission
  • the Treasury receives its part of the tax commission
  • Privateaser receives its part of the commission, plus the deductible reduction

Just tell me what to do

  • Compute the debit for the booker
  • Compute the credit of the bar, insurance, Treasury and Privateaser.
//example output from console.log
[
  {
    "deliveryId": "bba9500c-fd9e-453f-abf1-4cd8f52af377",
    "payment": [
      {
        "who": "booker",
        "type": "debit",
        "amount": ?
      },
      {
        "who": "bar",
        "type": "credit",
        "amount": ?
      },
      {
        "who": "insurance",
        "type": "credit",
        "amount": ?
      },
      {
        "who": "treasury",
        "type": "credit",
        "amount": ?
      },
      {
        "who": "privateaser",
        "type": "credit",
        "amount": ?
      }
    ]
  },
  ...
]

Source and inspiration

Licence

Uncopyrighted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.