To run this challenge you need to have docker installed in your machine, a Nix system is required.
First you need to build docker images using the first command. then run it using the second one. The first time you run the project you will need to setup the database using the 3rd command.
Have a look at https://docs.docker.com/get-started for more information.
bash build.shKeep this open to access the server under localhost:3000
bash run.shbash setup_db.shdocker-compose run app rake db:migrate
docker-compose run app rails generate
docker-compose run app bundle installYour goal is to create a website similar to klarx, where a customer can type in his location and sees the approximate logistic costs for a selected category and the nearest 3 products available.
- Create a website which shows 3 different categories and an address input field
- After selecting the category and submitting the address, the server should return the approximate delivery cost and show the nearest 3 product names
- Products are delivered by a hauling truck. Depending on the weight of the product, the hauler needs to choose a different truck, which results in different cost. Products < 5t cost 75 €/h and Products >= 5t cost 90 €/h
- Trucks need to be paid for the way to the construction site and also back, because they always drive back empty
- Matrix and geocoding API https://graphhopper.com/api/1/docs (API key: 1a751174-68c0-4792-bf22-60f3ca08712c )
- jQuery and any other Ruby / Javascript / Postgres tool or library you like
The database is already set up by the script and filled with seed data. See /dump.sql for more info.
- Products belong to Categories, categories have many Products
- Products belong to Stations, Stations have many Products
CREATE TABLE categories (
id bigint NOT NULL,
name character varying(20) NOT NULL
);
CREATE TABLE products (
id bigint NOT NULL,
name character varying(200) NOT NULL,
category_id bigint NOT NULL,
station_id bigint NOT NULL,
weight bigint NOT NULL
);
CREATE TABLE stations (
id bigint NOT NULL,
name character varying(200) NOT NULL,
latitude double precision NOT NULL,
longitude double precision NOT NULL
);- Correct delivery costs are calculated
- Input fields look “neat” and are easy to use
- Calculation of delivery cost does not take more than 2 seconds
- SOLID principles and best practices are used