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/Setup-associations #3

Merged
merged 10 commits into from
Aug 31, 2023
Merged

Feature/Setup-associations #3

merged 10 commits into from
Aug 31, 2023

Conversation

NitBravoA92
Copy link
Owner

@NitBravoA92 NitBravoA92 commented Aug 31, 2023

🚩Milestone 3: set up associations | setup-associations - >>branch<< -

Hi there! @NitBravoA92 here. 👋

This is the PR for the OOP school library: set up associations activity. The main goal of this Milestone is: create the remaining classes for the school library (Classroom, Book, Rental) and implement the associations relationship between classes.

Here is a summary of what has been done:

  • Create the Classroom class with two variables: @Label and @Students, and the method enter_student

  • Add the relationship between Student and Classroom

  • Create the Book class with two variables: @title and @author, and the method new_rental

  • Add the variable @rentals and the method new_rental in the Person class

  • Create the Rental class with three variables: @Date, @book and @person

  • Add the association relationships to the respective classes.

  • Update the run.rb file, with test code to demonstrate the functioning of the previously created classes

  • Update the README.md file

⭐To the code reviewer 👨‍💻

💝 I really thank 🙇‍♂️ you, dear code reviewer 👨‍🎨 for dedicating your precious 🥇 time ⌚ to check the PR 🧾 .

I kindly ask 🙏 dear code reviewer 🤵 that if there is any kind of issue 🦯 in this project, please do list 📃 them in a descriptive 💡 manner and give your best suggestions 🎁 if needed.

If you think some big issues are essential to be changed ♻️ please kindly contact 📞 me through Zoom or Slack, I am available on Microverse UTC-6 time zone.

Copy link

@levy002 levy002 left a comment

Choose a reason for hiding this comment

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

Hello @NitBravoA92 , 👋

I'm Levy, your PR reviewer

Good job so far 👍
There are some issues that you still need to work on to go to the next project but you are almost there!

Highlights

  • No linter error ✔️

Status: REQUIRED CHANGES ♻️

Check the comments under the review.

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 @levy002 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.

classes/book.rb Outdated
Comment on lines 2 to 3
attr_accessor :title, :author
attr_reader :rentals
Copy link

Choose a reason for hiding this comment

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

  • I'd recommend considering the use of both read and write access for the rentals attribute. By using the attr_accessor declaration instead of just attr_reader, you enable the class to not only allow the retrieval of rental information but also facilitate the addition and removal of rentals. This added flexibility can be valuable when managing rental history and making updates to rental records. This change will make your code more versatile and adaptable to various library management scenarios."

Comment on lines 10 to 13
def enter_student(student)
@students.push(student)
student.classroom = self # make this student part of this classroom
end
Copy link

Choose a reason for hiding this comment

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

  • When implementing the enter_student method, it's a good practice to ensure that the student is not already included in the classroom before adding them. You can achieve this by using a conditional statement. Before adding the student, check if the @students array already includes the student. If not, then proceed to add the student to the classroom and set their classroom attribute to the current classroom instance. This approach helps to avoid duplicate entries and ensures that each student is added to the classroom only once.
Suggested change
def enter_student(student)
@students.push(student)
student.classroom = self # make this student part of this classroom
end
def enter_student(student)
@students.push(student) unless students.includes(self)?
student.classroom = self # make this student part of this classroom
end

Copy link

@KanzaTahreem KanzaTahreem left a comment

Choose a reason for hiding this comment

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

Approved 🙌

Hi @NitBravoA92

Good job implementing the suggested changes💪 Your project is COMPLETE! There is nothing else to say other than... it's time to merge it! 🚀 Congratulations!

Highlights 🎯

There are some excellent points that you have made perfectly. Keep up the great work! 👏

  • ✅ Associations are correctly created
  • ✅ Great work using the right GitFlow
  • ✅ Your README looks good
  • ✅ Linters are working properly

Optional suggestions ❕

N/A

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.

@NitBravoA92 NitBravoA92 merged commit 7d98bbe into dev Aug 31, 2023
1 check passed
@NitBravoA92 NitBravoA92 added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants