Jump to content

Limit amount of subscriptions


Recommended Posts

Dear Caspio community,

 

I have an in depth question regarding the following tutorial: Limit the number of submissions

To get a better understanding of my issue I make use of the next example.

 

I want to make an app for booking seats at a movie. Just like in the tutorial i use 3 datapages for this.

  1. Search form - for searching movies.

  2. Booking form - for booking movies.

  3. Auto-update form - for increasing the number of booked_seats.

 

When a customer searches a movie he will have to go to the details page. The datapage determines if there are any seats available by checking if: booked_seats < max_available_seats. When this is the case a link is presented to the booking form where the  customer can book a seat for the movie, after submitting the booking form the booked_seats variable is increased by 1.

 

But, the following issues arise:

  1. The booked_seats variable is only increased after submitting the booking form. When there is only one seat left it is therefore possible that two customers get redirected. This would result in a double booking. (booked_seats = 11, max_available_seats = 10).

  2. When the admin of the movie wants to delete a record (a booking) the number of booked_seats remains the same.

 

So, my questions are:

 

  1. How to prevent double bookings? My idea was when the first customer presses the link his seat is reserved for 5 minutes, like some sort of “session”.

  2. How to decrease the number of booked_seats when a record is deleted? Or, even better, how to retrieve a realtime amount of bookings from my bookings_table?

I hope someone can help me with this matter. If you need any additional information regarding this issue, feel free to ask.

 

Link to comment
Share on other sites

The provided solution is not recommended. Look at Drawback.

In this implementation there is no validation if users access the submission form directly.

Since it is a browser side programming there ways to hack it. It is better if  you have developers custom program it and have a trigger to change the number. This way delete and double booking issue will no longer exist either.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...