Save dates and rates in the database

What is the best practice for this situation?

I am creating a reservation system and I am looking for the best way to capture and store information from the user. Each resource is available for one day and can accept any number of users to the maximum. So, for example, say that it is a balloon with a maximum of 5 people. I want my form to look like this:

[Buttons to select # of guests]  // So if a user wants the same price for 1-3 people he only has to enter it once.

From [START DATE] to [END DATE]: [RATE]  // Where the [] are input fields for the user

I plan to store each price in a database as:

Date, # of guests, rate

So, one line for each date.

Therefore, I need to convert " [START DATE]to [END DATE]" to store the values โ€‹โ€‹for each date. Should I do this client side in Javascript or in my controller in rails? If the rates are the same for a set of guests, i.e. 1-3 guests, is there a way to save this in the database for a better request? Or I should not worry, because if tomorrow the user wants to change the price for 2 guests, this may ruin my dB.

0
source share
1 answer

Start dateand End datevs. Each date- several conditions:

  • 3 , ? , resources.type, booked_resources.id.

  • , start end. booked_resource.id . . : MySQL

  • JS , for each day between start date and end date. , . , SQL/ , .

  • , db- (, ). "" , .

0

All Articles