-
Notifications
You must be signed in to change notification settings - Fork 299
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
Time- Mair H #33
base: master
Are you sure you want to change the base?
Time- Mair H #33
Conversation
…ia require and require_relative test files needed to run the minitests
…t is an instance variable in the Reservation class while an instance method in the DateRange class. updated tests accordingly
…p some of the reservation_dates tests for the Reservation class
…s- FrontDesk test are yet to be written
…n to implement the Room class method and instance variable- work in progress. no new tests written for any of the new changes
…m and dates_unavailable to Room to add all room reservations and return an array of all the dates the room has been booked respectively. wrote and modified list_of_reservations(date) and list_of_available_rooms(start_date, end_date) respectively to FrontDesk.
… date range dates and the duration of the stay respectively
…and a method to add room's reservation to it's own list
…d that call on DateRange object. room is inputted as a string and not a Room instance
…eing reservations for a specific date, and list of rooms available given a date range- tests are written but code base needs refactoring to dry up the code
…ion given a start and end 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.
Great job! Here are a few tips for how to clean up your code.
attr_reader :start_date, :end_date | ||
|
||
def initialize(start_date, end_date) | ||
raise(ArgumentError, "The end date #{end_date} is smaller or same as the start date #{start_date}.") unless 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.
Great use of a guard clause!
if (dates_unavailable & test_date_range).length > 0 | ||
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.
You can just directly return the condition here (once you negate it), since it's a boolean value:
if (dates_unavailable & test_date_range).length > 0 | |
return false | |
else | |
return true | |
end | |
return !((dates_unavailable & test_date_range).length > 0) |
Or even better:
if (dates_unavailable & test_date_range).length > 0 | |
return false | |
else | |
return true | |
end | |
return (dates_unavailable & test_date_range).length <= 0 |
before do | ||
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 don't need to include a before
if you don't have anything to stick in it.
expect(@reserve.instance_variable_get(:@start_date)).must_equal @start_date | ||
expect(@reserve.instance_variable_get(:@end_date)).must_equal @end_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.
In the future don't use things like instance_variable_get
instead just put an attr_reader
on the class.
HotelSection 1: Major Learning Goals
Section 2: Code Review and Testing Requirements
Section 3: Feature Requirements
Overall Feedback
Additional 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 did your test setup. I liked that you made sure there were several useful variables that you could re-use in future tests. I do see some room for improvement around TDD as mentioned above and also the design topics you touched on in your refactors file. Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
|
Assignment Submission: Hotel
Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.
Reflection