-
Notifications
You must be signed in to change notification settings - Fork 50
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
Branches - Michaela #38
base: master
Are you sure you want to change the base?
Conversation
… on the given date
…s that end on the given date
…mber' are included as parameters and are no longer randomly assigned
…nd 'list_of_reservations_by_date'
…ed 'find_room', 'find_reservation', and 'list_of_available_rooms_by_date' methods
…able rooms; also added tests for 'list_of_available_rooms_by_date', 'find_room', and 'find_reservation' methods
HotelWhat We're Looking ForTest Inspection
Code Review
Overall FeedbackGreat work overall! You've built your first project with minimal starting code. This represents an incredible milestone in your journey, and you should be proud of yourself! Your code is well-written! I think that your tests are well-written and cover all of the cases with all of the appropriate details. Your tests are really a great standard! Your implementation is also clean and logical and has elegant code style. A lot of your design is really thoughtful; from the big ideas of classes and their coupling, to also the details like optional arguments. Really great work! I've found some areas in which I could imagine you to refactor if you had more time in this project... a lot of these are small areas that I think could be more concise; they're generally minor suggestions. Overall, you did a great job on this! Great work! |
raise ArgumentError.new "Error! You entered an invalid room number: #{room_number_to_search}" | ||
end | ||
|
||
return @list_of_all_rooms.find { |room| room.room_number == room_number_to_search } |
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! This whole method is perfect!
raise ArgumentError.new "Error! You entered an invalid reservation number: #{reservation_number_to_search}" | ||
end | ||
|
||
return @list_of_all_reservations.find { |reservation| reservation.reservation_number == reservation_number_to_search} |
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.
Hm, I think that this method could be refactored to not use indicator
, but to utilize what .find
does if no match is found.
|
||
def list_of_available_rooms_by_date(date_to_check: ) | ||
unavailable_room_numbers = list_of_reservations_by_date(date_to_search: date_to_check).map do |reservation| | ||
reservation.room_number |
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.
the code in this method looks good-- It may be interesting to see if Reservation
s can reference Room
s so that getting the instance of Room
doesn't take so much work heh, or refactor the below loops so that that finding the available rooms doesn't take so much work. (I don't have any suggestions right now, sorry :) )
end | ||
end | ||
|
||
it "raises an ArgumentError if given an invalid collection of room numbers" 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.
This is great!
return true | ||
else | ||
return false | ||
end |
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.
Minor: Consider refactoring syntax like this to:
return date >= @start_date && date < @end_date
return false | ||
else | ||
return true | ||
end |
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.
Minor: Consider refactoring this to:
return !possible_room_numbers.empty?
Hotel
Congratulations! You're submitting your assignment!
Comprehension Questions