-
Notifications
You must be signed in to change notification settings - Fork 48
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
Ports - Laneia #45
base: master
Are you sure you want to change the base?
Ports - Laneia #45
Conversation
corrected out of date module name
HotelWhat We're Looking For
|
def initialize(name, check_in, check_out, block, rate) | ||
check_number_of_rooms(block) | ||
@name = name | ||
@check_in = check_in |
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.
You should also do something to verify the dates here.
end | ||
end | ||
|
||
def set_blocked_room_rate |
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 method doesn't make too much sense due to the fact that the room's rate only change for reservations within the block, not normal reservations.
end | ||
|
||
def available | ||
available_rooms = rooms.find_all { |room| room.block_reserved == nil } |
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.
Does this mean that a room can only be in one block at a time? What about two blocks on different dates?
@@ -0,0 +1,32 @@ | |||
module Calendar | |||
def Calendar.date_range_include?(reservation, 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.
It's good to have these methods, but wouldn't it make sense to make them instance methods of the Reservation
class or pulled into instance method of a DateRange
class? that way you could do?
my_reservation.includes(date)
my_reservation.does_not_overlap(other_reservation)
|
||
module Hotel | ||
class RoomReservation | ||
Room = Struct.new(:id, :cost, :block_reserved) |
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.
You don't seem to use this struct...
require_relative "full_room" | ||
|
||
module Hotel | ||
class RoomReservation |
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 class seems like it would be better named something like ReservationManager
. Something that describes it's function.
return new_reservation | ||
end | ||
|
||
def room_unavailable?(room, check_in, check_out) |
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.
Good method, but I think it should be a private helper method.
return blocked_rooms | ||
end | ||
|
||
def block_available_rooms(check_in, check_out, number_of_rooms, rate) |
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 should also be a private helper method.
2 - Test data read from a CSV file could have been more thorough and led to better | ||
tests | ||
|
||
3 - I'm not sure that I like Calendar being a separate module but I'm not sure how |
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.
Check out my comment above
@reservation3 = @hotel.new_reservation(room_id3, check_in3, check_out3) | ||
end | ||
|
||
it "instantiates a new Reservation and adds it to master collection" do |
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.
You should also test that you can add a reservation on the same date the previous reservation ends.
Hotel
Congratulations! You're submitting your assignment!
Comprehension Questions
Side note, I have no idea what happened between my files and Github. I believe I was pushing to the wrong branch somehow, and then had a bunch of trouble trying to transfer them over so eventually I just used file uploader in a web browser to add the files to this correct repository. Apparently those are the only commits viewable now.