• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

[UB] 48 hour rule + scenario + code

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey!
There's a lot of threads about that rule but I want to tell You my approach (fable is the price

So, they takes bookings only within 48 hours, and they sell accomodations for business and pleasure travelers at short notice.

In db schema I see 2 fields per record: Price per night (Charge per night for the room) and Date available (The single night to which this record relates)

Try to imagine such scenario:

24/OCT/2008 22:40 (Friday night... )

What can You do at Friday night? 1st option: go with friends and drink some beer, 2nd option: try to finish SCJD...

Let say You we choose 1st, at some point we have to find place to sleep or where we can continue party. We were lucky, because one our friend has phone to UrlyBird, that company "sell accommodations for business and pleasure travellers at short notice." Sounds good, ok it's late (22:40) and they take bookings only before midnight (also hotel's receptions does not work after midnight). So lets hurry up! Quick call to UrlyBird ...

[Jessica] Hello..
[We] Hi, we are looking for nice room were we can move our party, do You have any?
[Jessica] Hmm let me check, searching... Yup I found one room available today ('2008/10/24') hotel 'President' do You want it?
[We] Sure!
[Jessica] Wait a sec., let me make a booking. Done, but hurry up, You have to be there before midnight, in other case janitor will not let You come in.
[We] Thanks!

So they have it, and they can continue their party for whole long night

That scenario helped me to understand and implement 48 hr rule:

-If '2008/10/24' is availability date 'The single night to which this record relates' then client can book room before midnight (also hotels accept that hour)

So I can book room before 2008/10/24 23:59:59 but after 2008/10/22 23:59:59. So there is exactly 48 hours


I'm taking '2008/10/24' which is 2008/10/24 00:00:00 and the rule is:



I think that match perfectly with my scenario, and also it adhere to hotel business rules.

What do You think?

Ouch it's Friday night... I'm going to get some beer ....
[ October 24, 2008: Message edited by: Sebastian Puzon ]
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sounds reasonable to me
reply
    Bookmark Topic Watch Topic
  • New Topic