Giter Site home page Giter Site logo

wachunga / car-share-fare Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 744 KB

How much will that car share trip cost? Limited to car shares Evo and Modo for now

Home Page: https://carshare.vercel.app

License: MIT License

TypeScript 79.41% HTML 19.91% JavaScript 0.68%
calculator car-share hacktoberfest sharing-economy typescript vancouver

car-share-fare's People

Contributors

dependabot[bot] avatar wachunga avatar

Watchers

 avatar

car-share-fare's Issues

Do money properly

There are floating point issues with handling currency just as numbers in javascript. Better deal with this sooner rather than later.

I've used big.js in the past but this looks promising: https://github.com/sarahdayan/dinero.js (comes with formatting, currencies, etc)

Add support for car2go

something like this:

const car2go = {
  key: "car2go-yvr",
  url: "https://www.car2go.com/CA/en/vancouver/rates/",
  lastUpdate: "2019-06-15",
  currency: "CAD",
  fees: {
    trip: 1, // first 200 trips per calendar year
    registration: 5,
    annual: 2,
    daily: 1.5 // tax on trips lasting 8 hours or more
  },
  packages: [
    {
      name: "minute rate - smart",
      vehicle: "smart fortwo",
      maxPassengers: 2,
      time: [{ per: 1, cost: 0.32 }],
      distance: {
        unit: "km",
        steps: [{ start: 0, end: 200, cost: 0 }, { start: 200, cost: 0.45 }]
      }
    },
    {
      name: "minute rate - mercedes",
      vehicle: "Mercedes Benz CLA/GLA",
      maxPassengers: 5,
      time: [{ per: 1, cost: 0.45 }],
      distance: {
        unit: "km",
        steps: [{ start: 0, end: 200, cost: 0 }, { start: 200, cost: 0.45 }]
      }
    },
    // TODO: 3 hours - smart
    {
      name: "3 hours - mercedes",
      vehicle: "Mercedes Benz CLA/GLA",
      maxPassengers: 5,
      time: [
        { start: 0, cost: 45 }, // 3 hours
        { start: 60 * 3, per: 1, cost: 0.32 }
      ],
      distance: {
        unit: "km",
        steps: [{ start: 0, end: 200, cost: 0 }, { start: 200, cost: 0.45 }]
      }
    },
    // TODO: 6 hours
    // TODO: 1 day (200)
    // TODO: 2 days (400)
    // TODO: 3 days - smart
    {
      name: "3 days - mercedes",
      vehicle: "Mercedes Benz CLA/GLA",
      maxPassengers: 5,
      time: [
        { start: 0, cost: 249 }, // 3 days
        { start: 60 * 24 * 3, per: 1, cost: 0.32 }
      ],
      distance: {
        unit: "km",
        steps: [{ start: 0, end: 600, cost: 0 }, { start: 600, cost: 0.45 }]
      }
    }
  ]
};

Add a basic UI

Just an MVP. Can polish later.

  • two inputs boxes (minutes, km)
  • submit calls computeCosts and presents the results in a table
  • host on github pages?

Later, we can integrate with google maps (or similar) to calculate the distance for you

Update car2go costs - July 29

Prices are going up slightly effective July 29 according to an email I received Jun 29:

The long distance fee will be increasing from $0.45/kilometer to $0.49/kilometer. This fee only applies if you go over your allotted mileage in a Trip Package or surpass 200 km of driving when you select the Per Minute Rate.

For later: I suppose this will be a common use case. Probably we should include the notion of "effective date" so this config can be added in advance.

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.