-
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
Daniela Sanchez - Leaves #28
base: master
Are you sure you want to change the base?
Conversation
…king on list of reservations by date
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! I am particularly impressed by the way that you broke down these large problems into bite-sized methods. I can very clearly see your thinking and follow along with your code! I do see some room for improvement around your git usage, and more thorough testing. You seem to be missing a couple of important cases, and it might be easier to test those cases from within something like the block or reservation class. Also, use what we talked about in our discussion of POODR chapter 4 to use delegation more extensively, so that |
block.rooms | ||
end | ||
else | ||
raise ArgumentError.new("Invalid block") |
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 line doesn't get hit by your tests.
attr_reader :check_in, :check_out, :rooms, :discounted_rate | ||
|
||
def initialize(check_in, check_out, rooms = [], discounted_rate) | ||
@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.
When a class only has instance variables and no methods, either it doesn't need to be a class, or you're doing that class's work somewhere else. This class should be able to make its own reservations, and report information about when it is available.
(check_in...check_out).each do |date| | ||
if @reservations_by_date[date] != nil | ||
@reservations_by_date[date].each do |reservation| | ||
available_rooms[reservation.room - 1] = false |
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 code is looking inside each of the reservations to make its decision, so it is probably doing something outside its responsibilities.
def validate_less_6_rooms(num_rooms) | ||
unless num_rooms <= 5 | ||
raise ArgumentError.new("A block can contain a maximum of 5 rooms") | ||
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.
You're validating for the block here.
Hotel
Congratulations! You're submitting your assignment!
Comprehension Questions