Skip to content
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

sammi-jo's HOTBOOK (nodes) #28

Open
wants to merge 59 commits into
base: master
Choose a base branch
from
Open

Conversation

sjlee3157
Copy link

@sjlee3157 sjlee3157 commented Sep 10, 2018

Hotel

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a design decision you had to make when working on this project. What options were you considering? What helped you make your final decision? For a while, I wanted to pursue making a Reservation class that could store all instances of reservations and had self.all and self.find (etc.) methods -- to make it more independent from the Book class, and to apply a concept from class that I felt hazy and curious about to gain more mastery of it. However, I ultimately decided that the cost of learning how to do that, and the trial and error it would require, wasn't worth it for this project, so I stuck with a model more similar to ride-share-oo that I knew I knew how to do.
Describe a concept that you gained more clarity on as you worked on this assignment. I am much more comfortable with MiniTest, and using MiniTest together with pry, than I was before this project. It took some experimenting to get the hang of what information is created and destroyed at what points when the spec file is running.
Describe a nominal test that you wrote for this assignment. book.new_reservation() assigns the first available room number for the date range, creates an instance of the Reservation class, and adds the new instance to an instance variable array.
Describe an edge case test that you wrote for this assignment. Booking the same new reservation 21 times, however, returns an error, because all 20 rooms in the hotel will have been assigned already.
How do you feel you did in writing pseudocode first, then writing the tests and then the code? At the beginning, I felt like I was losing much more time by writing tests than it was worth to have created a test file that could live with the code and run with it. It was very, very slow going to write tests at first, until I got the hang of setting up tests. By Wave 3, I had some more flow in writing tests, and test writing + pseudocode became more like one process. That's because I could write tests more naturally, almost like rubber ducking out loud about what my code should do, integrating the test writing in to my coding process.

@CheezItMan
Copy link

CheezItMan commented Sep 13, 2018

Hotel

What We're Looking For

Feature Feedback
Baseline
Used git regularly Good number of commits and good commit messages
Answer comprehension questions Check
Design
Each class is responsible for a single piece of the program Yes, although you have an extraneous class that's not doing very much.
Classes are loosely coupled Check
Wave 1
List rooms Check
Reserve a room for a given date range Check
List reservations for a given date Check
Calculate reservation price Check
Invalid date range produces an error Check
Test coverage 100%
Wave 2
View available rooms for a given date range Check
Reserving a room that is not available produces an error Check
Test coverage 100%
Wave 3
Create a block of rooms Check, although it's requiring the user to specify the rooms in the block.
Check if a block has rooms Check
Reserve a room from a block Check
Test coverage 100%
Fundamentals
Names variables, classes and modules appropriately You need to work on your class names a bit. Some of the names like Hotel and Book are unclear in what they do
Understanding of variable scope - local vs instance Check
Can create complex logical structures utilizing variables Check
Appropriately uses methods to break down tasks into smaller simpler tasks Check, well done in building small specific methods.
Understands the differences between class and instance methods Check, no class variables (good job!), and a few useful class methods.
Appropriately uses iterators and enumerables Well done
Appropriately writes and utilizes classes check
Appropriately utilizes modules as a mechanism to encapsulate functionality Check
Wrap Up
There is a refactors.txt file Check
The file provides a roadmap to future changes Well done, very well laid out
Additional Feedback Well done, you did a good job with the design and write fairly efficient code. Very nice work here.

lib/book.rb Outdated
end
# Cannot overlap or conflict with existing reservation
rooms.each do |room_number|
if room_taken?(daterange, room_number)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break if ONE room is unavailable in the date range.

Correction
Normally when you're reserving a block of rooms you specify the number and the system picks the rooms. The front Desk doesn't have to individually select them.

When we met, I missed the fact that you're passing in the list of rooms to include in the block as a parameter. I just hadn't consider it at that moment. So your code works, but with a limitation that the user has to specify every room to include in the block, rather than just selecting a group from the available rooms.

@@ -0,0 +1,24 @@
# gems the project needs

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file's a neat idea!

@available = rooms.clone
@room_rate = room_rate
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So Block has a set of rooms and a way to remove rooms from the list, and tell if the block conflicts, I feel like it should be able to reserve a room in the block as well, maybe then returning a reservation which your booking system could use to update reservations.

lib/book.rb Outdated
# making new reservations and blocks.
# It includes support methods for determining availability/conflicts.

class Book

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a better name is BookingManager. Book sounds like I should be able to turn pages and get an author.

lib/book.rb Outdated
attr_reader :reservations, :hotel, :blocks

def initialize(hotel) # expects a dependency injection (HotBook::Hotel.new)
@hotel = hotel

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the@hotel variable supposed to do?


describe "disable method" do
it "won't alter the rooms array when it executes" do
block.disable("1")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe check that it contained 1 before and then it doesn't after.

end
end

describe "conflict? method" do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should test more varieties of conflicts.

describe "disable method" do
it "won't alter the rooms array when it executes" do
block.disable("1")
expect(block.available).must_equal ["2", "3"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also what happens if you try to disable a room twice?

end

it "new reservation edge case" do
expect{ 21.times { book.new_reservation(shortrange) } }.must_raise HotBook::NoRoomsAvailableError

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

expect{book.new_block(daterange, rooms)}.must_raise HotBook::BlockConflictError
end

it "cannot overlap or conflict with an existing reservation" do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants