Re: Re: Hold System

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> In the example of Bob, Mary and Barbara that I gave in my last post.  If
> Bob cancels his hold and I reset date_held for mary to the current date,
> so that she has adiquite time to place her student.  If I do that this
> will put Barbara into the #1 position because she has now put a hold
> before Mary.
>
> With this beig the case, would the best solution be to recursively go
> through the others holding the student(Mary and Barbara), and set Mary's
> date_held to now, and Barabara's date_held to a minute after (a time
> which has most likely has not occurred yet) Mary's.

I'd simply go by your date_created (and I'm assuming that's a timestamp of
some kind with minute or second granularity).  Leave that to the time the
record was created.  Then, by definition, the "#1 position" is always:

SELECT * FROM hold_tracker
WHERE STUDENT_ID = {whatever} AND valid = 1
ORDER BY date_created ASC
LIMIT 0,1

No need to update anybody's record except Bob's (when it is expired or
cancelled), and Mary's (to indicate when her time window opens). Barbara's
record shouldn't need any sort of touching whatsoever.  No touchy!

Unless you meant date_created to be the date they created the firm booking,
not the date they placed the request for a hold.   In which case you might
substitute 'id', since it will number everything sequentially by order of
receipt anyhow.

-P

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux