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

Feature/associations #3

Merged
merged 12 commits into from
Aug 28, 2023
Merged

Feature/associations #3

merged 12 commits into from
Aug 28, 2023

Conversation

ClaudiaRojasSoto
Copy link
Owner

Description

This pull request aims to integrate the final classes and their associations for our school library project. The changes align with the project requirements and Ruby best practices.

General Requirements

  • No linter errors are present.
  • Correct Gitflow was followed.
  • All work is documented in a professional manner.

Implemented Features

Classroom Class

  • Add the @label instance variable with initialization in the constructor.
  • Implement setter and getter for @label using attr_accessor.
  • Establish a "has-many" relationship with the Student class.
  • Ensure that adding a student to a classroom also sets the classroom for the student.

Book Class

  • Added @title and @author instance variables with initialization in the constructor.
  • Implemented setters and getters for these instance variables using attr_accessor.

Rental Class

  • Added @date instance variable with initialization in the constructor.
  • Implemented setter and getter for @date using attr_accessor.

Person-Book-Rental Associations

  • Created a many-to-many relationship between Person and Book through the intermediate Rental class.
  • Implemented the "has-many" side of Book and Rental.
  • Implemented the "belongs-to" side of Rental and Book.
  • Implemented the "has-many" side of Person and Rental.
  • Implemented the "belongs-to" side of Rental and Person.
  • Modified the constructor of Rental to set Book and Person.

Please, review this project feature and give me feedback to improve it.
Greetings,
@ClaudiaRojasSoto

…the instance variable label on the constructor, and getters and setters for that variable using attr_accesor. In addition, Create the has-many/belongs-to relationship between Classroom and Student"
…structor the instance variables title and author, and add getters and setters instances to title, author and rentals
…tance variable date on the cosntructor and creates getters and setters for date with attr_accessor. In addition add a relationship many-to-many betwin person and book
… 'has-many' relationship with the Rental class. Adds a method for adding new rentals to a person's list of rentals. And Updates access methods and attributes as per requirements.
Copy link

@Olamarx Olamarx left a comment

Choose a reason for hiding this comment

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

Hi @ClaudiaRojasSoto,

Good job so far, indeed you have spent time on this project!
There are some issues that you still need to work on to go to the next project but you are almost there!

Highlights

  • Readme file professional ✔️
  • Linters passed ✔️
  • Gitflow ✔️

Required Changes ♻️

Check the comments under the review.

  • I realized that you did not create the classroom method which should be responsible for setting the classroom for a student and also add it to the classrooms' students. Remember the relationship too.

What you have now

image

Optional suggestions

Every comment with the [OPTIONAL] prefix is not crucial enough to stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better.

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

book.rb Outdated
# this class represents the books
class Book
attr_accessor :title, :author
attr_reader :rentals
Copy link

@Olamarx Olamarx Aug 28, 2023

Choose a reason for hiding this comment

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

  • The rentals should be set for getter and setter since we will also be adding and reading it from the UI.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thank you @Olamarx. Done!

book.rb Outdated
Comment on lines 9 to 11
@rentals = []
end
end
Copy link

@Olamarx Olamarx Aug 28, 2023

Choose a reason for hiding this comment

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

  • There should be a method for adding rentals here, just as you have it in person class but would have parameters for person and date so that it would serve that purpose but peculiar rentals here. Remember that in the method, the book itself should be sent as a parameter to create the new rental achieving the 'has-many' association

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thank you @Olamarx. Done!

rental.rb Outdated
# this class represents the rental
class Rental
attr_accessor :date
attr_reader :book, :person
Copy link

@Olamarx Olamarx Aug 28, 2023

Choose a reason for hiding this comment

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

  • Getters and Setters for book and person but you are only setting the Getter, it is necessary for the two to be writeable.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thank you @Olamarx. Done!

Copy link

@OyePriscilla OyePriscilla left a comment

Choose a reason for hiding this comment

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

Hi @ClaudiaRojasSoto 👏 👏,

Your project is complete! There is nothing else to say other than... it's time to merge it :shipit:
Congratulations! 🎉

200

Highlights

Set up associations between classes and objects. ✔️

Optional suggestions

Every comment with the [OPTIONAL] prefix won't stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better. Some of them were simply missed by the previous reviewer and addressing them will really improve your application.

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

@ClaudiaRojasSoto
Copy link
Owner Author

Thank you @OyePriscilla!!

@ClaudiaRojasSoto ClaudiaRojasSoto merged commit dd64239 into develop Aug 28, 2023
1 check passed
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.

None yet

3 participants