-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ampers: Alex #24
base: master
Are you sure you want to change the base?
Ampers: Alex #24
Conversation
…split rooms into availble and booked
HotelWhat We're Looking For
|
@@ -0,0 +1 @@ | |||
WHERE IS ADA? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here!
1215 4th Ave
Suite 1050
Seattle, WA 98161
lib/admin.rb
Outdated
@blocks = [] | ||
|
||
@reservations.each do |reservation| | ||
overlap = reservation.dates & days |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work unless days
has an exact date of a reservation. So this requires your reservations to keep all the dates it's reserved.
However doing it this way does make & work, clever.
You also will need to consider rooms in blocks however.
|
||
admin.book_room(res1) | ||
|
||
admin.rooms.length.must_equal free_rooms - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test doesn't make sense, the number of rooms doesn't change when a room is booked, the number of free rooms in a date range would change.
@reservations.each do |reservation| | ||
overlap = reservation.dates & days | ||
if overlap.length > 0 | ||
@rooms.pop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the room from the list doesn't make sense, since when I book a room the hotel doesn't lose a room permanently.
lib/admin.rb
Outdated
book_room(reservation) | ||
end | ||
|
||
def create_block_of_rooms(reservation, num_rooms) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about:
- Creating a block with a discounted room rate.
- Is a block a
Reservation
? - Is a room really reserved, if it's in the block, or is it just being held for later?
Hotel
Congratulations! You're submitting your assignment!
Comprehension Questions