The Student Room Group

Computing Project - Implementation help

Hi,

I am currently doing my computing project - I am creating a library booking system and I have become stuck.
One of the processes of the system is that students can reserve a computer online.

How would I go about doing this? There can be no double bookings either.

Please help and thanks!

Lakhvir.
Reply 1
You would need a procedure which searches the file for all bookings on that day, then only add the times which are not booked. You would need a simple search of the file,
If slot1 not booked then
add time to drop down box
Very simple pseudocode
Original post by klbmanu
You would need a procedure which searches the file for all bookings on that day, then only add the times which are not booked. You would need a simple search of the file,
If slot1 not booked then
add time to drop down box
Very simple pseudocode


So would I have to amend my database in order to accommodate time slots? My current bookings tables has the following fields:
Booking ID, Student ID, PC ID, Time start, Time end, Date.
Original post by Lakhvir.Singh
So would I have to amend my database in order to accommodate time slots? My current bookings tables has the following fields:
Booking ID, Student ID, PC ID, Time start, Time end, Date.


Yes, because otherwise it gets tricky when you have a student who has booked say 9am to 9.45 and another who wants to book 9.30 to 10.00 on the only remaining PC.
It's better to identify definite slots for each PC.
Eg hourly slots at 9, 10, 11 etc
Then you have an array of bookable slots that can be flagged as booked or not.
Eg 10 PCs each with 8 bookable hourly slots gives an array of 10 by 8 slots.
A booking is then uniquely identified by its date and slot.
Original post by Stonebridge
Yes, because otherwise it gets tricky when you have a student who has booked say 9am to 9.45 and another who wants to book 9.30 to 10.00 on the only remaining PC.
It's better to identify definite slots for each PC.
Eg hourly slots at 9, 10, 11 etc
Then you have an array of bookable slots that can be flagged as booked or not.
Eg 10 PCs each with 8 bookable hourly slots gives an array of 10 by 8 slots.
A booking is then uniquely identified by its date and slot.


Hi,

Could I not just make a new table called Times and have the following fields:
Time ID, Time Start and Time End. Then in the bookings table I could assign just have
Booking ID, Student ID, PC ID, Time ID, Date?
Original post by Lakhvir.Singh
Hi,

Could I not just make a new table called Times and have the following fields:
Time ID, Time Start and Time End. Then in the bookings table I could assign just have
Booking ID, Student ID, PC ID, Time ID, Date?


But how do you prevent double bookings or overlapping bookings?
You could have two records in that "Times" table, one from 9.00 to 10.00 and one from 9.30 to 10.00, each with a unique TimeID and both assigned to the same PC on the same day in the bookings table.
Creating fixed slots produces a method whereby you can avoid double bookings.
If date and slot are unique key fields then you can't have two bookings of the same slot on the same date.
Hi,

Thank you for replying.

How would I go about making the fixed slots?
Three tables I currently have are:
Students(Student ID, Forename, Surname, DOB etc)
PC's( PC ID, Room)
Pc Booking ( PC booking ID, Student ID, PC ID, Time Start, Time End, Date)

Sorry for being a noob :P
Reply 7
Original post by Lakhvir.Singh
Hi,

Thank you for replying.

How would I go about making the fixed slots?
Three tables I currently have are:
Students(Student ID, Forename, Surname, DOB etc)
PC's( PC ID, Room)
Pc Booking ( PC booking ID, Student ID, PC ID, Time Start, Time End, Date)

Sorry for being a noob :P

In the `PC Booking` table replace `Time Start` and `Time End` with `Time Slot`, which can just be an integer value representing a particular slot.
For instance, 0 could represent 8:05-9:00 if that is the earliest slot available, 1 is 9:05-10:00, etc.

To prevent double booking, then you just need to check that none of the bookings in the `PC Booking` table use the same slot as the person who is trying to book.

By the way, for the start and end times, that would not be particularly hard either. You just have to check that nobody's start or end times are in the range of your start or end times.
It is barely any more complicated to make, and if you did it properly there would be no meaningful affect in performance (unless you are intending to roll this out into millions of simultaineous computer bookings in a day, in which case you have other considerations too). If you did go down this route, I would advise splitting the time into slots, but slots of 5 minutes, and then people will specify a range of between, say, 3 and 24 consecutive slots.
Hey guys, thank you for all the replies.
I want the process to be similar to this:
http://www.erl.vic.gov.au/intranet/web/pcbookings.php?event=choose

The user selects a room, selects a date and then a list of available computers and time slots come up. I'm struggling to think of how to set the time slots up lol. There are 10 computers and the slots will be 1 hour, monday to friday.

Can somebody please help me?? :frown:

Quick Reply

Latest

Trending

Trending