Completed

Desarrollo de Script de Fechas Encimadas

Published on the April 17, 2019 in IT & Programming

About this project

Open

Requirements
1. User is able to specify price depending on the dates. i.e. Set the price $x for the dates range $startDate - $endDate. Let’s call such ranges as intervals.
2. User can add as many intervals as he wants (using any start/end date).
3. System can’t have crossing intervals.
4. New interval price have higher priority over existing ones.
5. New interval can’t lead to changes in dates not belonged to its dates range.
6. If user tries to save interval that interferes with existing ones in DB, system has to
apply last user changes and modify other intervals in order to apply requirement
3.
7. Any intervals with the same price that can be merged (without gaps between)
should be merged.

DB
You need to develop a system for saving prices in intervals. Each interval should have such fields:
● date_start (date)
● date_end (date)
● price (float)
What you need to do:
Unit tests for what you consider to be necessary
● As minimum queries to DB as possible
● Well documented code

Examples
For intervals in examples used format (date_start-date_end:price), for example (1-10:15), that means that date_start = 1, date_end = 10, price = 15

Example 1
Step 1: Operation -> Add (1-10:15)  Result -> (1-10:15)
Step 2: Operation -> Add (5-20:15) Result -> (1-20:15)
Step 3: Operation -> Add (2-8:45)  Result -> (1-1:15), (2-8:45), (9-20:15)
Step 4: Operation -> Add (9-10:45) Result -> (1-1:15), (2-10:45), (11-20:15)

Example 2
Step 1: Operation -> Add (1-5:15) Result -> (1-5:15)
Step 2: Operation -> Add(20-25:15) Result -> (1-5:15), (20-25:15)
Step 3: Operation -> Add (4-21:45) Result -> (1-3:15), (4-21:45), (22-25:15)
Step 4: Operation -> Add (3-21:15) Result -> (1-25:15)

Category IT & Programming
Subcategory Web development
What is the scope of the project? Create a new custom site
Is this a project or a position? Project
I currently have I have specifications
Required availability As needed
Roles needed Developer

Delivery term: Not specified

Skills needed