13
Views
8
Comments
Solved
Time input validation
Application Type
Mobile

Hi ,

I'm making a room booking platform and have encountered an issue during input validation, My current validations stop the user from booking a room at an already booked time , but the user is able to book a room in between the start and end time of a booking. 

For example : user A books a room from 12 to  1.

User B tries to book the room at 12 or 1 = the application stops the user from doing so 

but

User B is able book the room in between 12:01 to 12:59  = this shouldn't happen , I haven't been able to work out a solution to this problem

Any help would be appreciated .


Rank: #295
Solution
  1. Put this (BookingStartTime >= Entity.StartTime and BookingStartTime <=Entity.EndTime) and (BookingEndTime >= Entity.StartTime and BookingEndTime <= Entity.EndTime) condition in your DB aggregate .
  2. In your action,  refresh this aggregate.
  3. At the last, use an IF to check if Aggregate is empty or not, if it is empty, allow user to book time else throw exception.

Hope i'm clear to you, Thanks

Rank: #295

Hi Noor,

What should happen if your booking time is from 11 to 12? It will allow user or not then?

And one more, What inputs user have to book time for a room?

Please confirm so that, it would be helpful for us to give you solution.

Thanks

Rank: #295

You can try using following validation rule if you have two inputs for BookingStartTime and BookingEndTime

If((BookingStartTime >= Entity.StartTime and BookingStartTime <=Entity.EndTime) and (BookingEndTime >= Entity.StartTime and BookingEndTime <= Entity.EndTime))

True{

//Show Validations

}

False{

//Allow Booking

}

Hope this helps, Thanks :)