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

Time - Hannah #42

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

Conversation

stpatrickschild
Copy link

Assignment Submission: Hotel

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Question Answer
What was a design challenge that you encountered on this project?
What was a design decision you made that changed over time over the project?
What was a concept you gained clarity on, or a learning that you'd like to share?
What is an example of a nominal test that you wrote for this assignment? What makes it a nominal case?
What is an example of an edge case test that you wrote for this assignment? What makes it an edge case?
How do you feel you did in writing pseudocode first, then writing the tests and then the code?

@beccaelenzil
Copy link

Hotel

Section 1: Major Learning Goals

Criteria yes/no, and optionally any details/lines of code to reference
Practices SRP by having at least two separate classes with distinct responsibilities, and test files for these two classes ✔️
Overall, demonstrates understanding instance variables vs. local variables. (There aren't unnecessarily too many instance variables, when it should be a local variable) ✔️
For each test file, tests demonstrate an understanding of instantiating objects properly, and using Arrange-Act-Assert ✔️
Practices pseudocode and TDD, and reflected on it by filling out the reflection questions Reflection questions aren't complete at the time I am reviewing this. I will check back next week.
Practices git with at least 15 small commits and meaningful commit messages You should commit your changes frequently. For instances, after you write the tests for a single method.

Section 2: Code Review and Testing Requirements

Criteria yes/no, and optionally any details/lines of code to reference
There is a class that represents a reservation, and a second class that holds/manages a collection of reservations through composition (instance variable) ✔️
The logic for checking if a reservation's date overlaps with another reservation's date is complex logic that is separated into method(s) (and potentially class(es)) ✔️
The logic for checking if a reservation's date overlaps with another reservation's date has unit tests ✔️
All of the given tests run and pass ✔️
A test coverage tool is installed and used, and shows 95% test coverage ✔️ system as 93% coverage. Click on the system.rb in the index.html to see which lines aren't covered.

Section 3: Feature Requirements

Feature Requirement: There is a method that... yes/no
gives back a list of rooms, and it's tested ✔️
creates a specific reservation for a room for a given date range, and it has nominal test cases ✔️
creates a specific reservation for a room for a given date range, and it tests an edge case, such as no available room, or invalid date range This method is implemented an there's a nominal test case. Edge cases also need to be tested
gives back a list of reservations on a given date. Its tests include a test that makes several reservations for a given date Only a single reservation is tested
calculates the total price for a reservation ✔️
gives back a list of available rooms for a given date range, and it has nominal test cases avail_rooms does not have any tests
gives back a list of available rooms for a given date range, and it has edge test cases, such as no available room, or invalid date range avail_rooms does not have any tests
creates a block of rooms not completed (that's ok :)
reserves a room from a block not completed (that's ok :)

Overall Feedback

Overall Feedback Criteria yes/no
Yellow (Approaches Standards) 9-13 total in all sections ✔️

Additional Feedback

Great 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 wrote thorough tests for the DateRange methods. Furthermore, you eloquently worked through tricky logic to assign a room to a reservation. It is clear that the learning goal around object oriented design were met for this project.

I do see some room for improvement around the thoroughness of your tests. It is important to test nominal and edge failure and success cases for each of your methods. Using TDD practices and pseudocode can help you consider all the test cases before you even implement the code.

Please let me know if you have questions about the tests for this project.

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Descriptive/Readable
Concise
Logical/Organized

else
return true
end
# if date_range1.start_date <= date_range2.start_date && date_range1.end_date >= date_range2.end_date

Choose a reason for hiding this comment

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

Nice work refactoring this code. You should delete the commented code. This would be a great moment to commit! git commit -m "refactored DateRange.overlap?.

Choose a reason for hiding this comment

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

Consider making this in an instance method such that it would be called like this date_range1.overlap?(date_range2)

# get that reservation_id to get the duration
# after getting duration, calculate cost

# found_reservation = @reservations.find do |reservation|

Choose a reason for hiding this comment

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

Remember to remove unused code before submitting.

# Assert
expect (duration).must_equal 4
end
describe "overlap" do

Choose a reason for hiding this comment

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

These tests are very comprehensive. Nice work! Consider naming them with the particular test case they test for. See the example below from the design scaffold.

Choose a reason for hiding this comment

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

describe "overlap?" do
    before do
      start_date = Date.new(2017, 01, 01)
      end_date = start_date + 3

      @range = Hotel::DateRange.new(start_date, end_date)
    end

    it "returns true for the same range" do
      start_date = @range.start_date
      end_date = @range.end_date
      test_range = Hotel::DateRange.new(start_date, end_date)

      expect(@range.overlap?(test_range)).must_equal true
    end

    xit "returns true for a contained range" do
    end

    xit "returns true for a range that overlaps in front" do
    end

    xit "returns true for a range that overlaps in the back" do
    end

    xit "returns true for a containing range" do
    end

    xit "returns false for a range starting on the end_date date" do
    end

    xit "returns false for a range ending on the start_date date" do
    end

    xit "returns false for a range completely before" do
    end

    xit "returns false for a date completely after" do
    end
  end

  xdescribe "include?" do
    it "reutrns false if the date is clearly out" do
    end

    it "returns true for dates in the range" do
    end

    it "returns false for the end_date date" do
    end
  end

def find_avail_room(date_range)
rooms.each do |room|
room_reservation = reservations.select { |reservation| reservation.room_num == room }
if !room_reservation.any? { |reservation| DateRange.overlap?(reservation.date_range, date_range) }

Choose a reason for hiding this comment

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

Good use of an enumerable method.

expect(res_array.length).must_equal 1
end

it "raises exception, if no available rooms" do

Choose a reason for hiding this comment

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

This is a clever way to test this edge case!

require_relative "test_helper"

describe "System class" do
it "gets lists of rooms" do

Choose a reason for hiding this comment

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

To increase readability and ensure you are fully testing your methods, group the tests for a single method together using a describe block.

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