-
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
Jan Edrozo | Carets #30
base: master
Are you sure you want to change the base?
Conversation
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.
Some in-code comments.
@cost = cost | ||
end | ||
|
||
def self.all |
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.
Nice that you did the CSV work, but wouldn't it make sense to just store the Reservations
instead, the rooms are just IDs and costs, while the reservations have the interesting and complex data.
lib/hotel_admin.rb
Outdated
|
||
def reserve_room(first_name, last_name, room_id, room_rate, start_date, end_date, block_id = nil) | ||
|
||
raise InvalidDateRangeError.new("Date range conflicts with room requested") if end_date <= start_date |
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.
If the Reservation
deals with invalid dates, HotelAdmin
doesn't have to.
|
||
if block_id.nil? #if a room doesn't have a block_id, blacklist all rooms that are blocked | ||
raise UnavailableRoomError.new("Room is unavailable") if @block_list.any? do |block| | ||
block.date_range.overlaps?(requested_range) && block.rooms_array.any? { |room| room.id == room_id } |
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 couples Block (and similarly
Reservation`) very tightly. Instead you could create a method in Reservation & Block that checks to see if it contains the room/date combo.
lib/hotel_admin.rb
Outdated
|
||
def reserve_block(block_id, date_range, rooms_array, discount_room_rate) | ||
|
||
if @block_list.any? { |block| block.date_range.overlaps?(date_range) } |
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.
It doesn't seem to check to see if there are reservations for the given rooms.
HotelWhat We're Looking For
|
Hotel
Congratulations! You're submitting your assignment!
Comprehension Questions