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/Preserve data #6

Merged
merged 23 commits into from
Sep 6, 2023
Merged

feature/Preserve data #6

merged 23 commits into from
Sep 6, 2023

Conversation

NitBravoA92
Copy link
Owner

🚩Milestone 6: preserve data | read/write - >>branch<< -

Hi there! @NitBravoA92 and @ahmedeid6842 here. 👋

This is the PR for the preserve data activity. The main objective of this Milestone is to learn how to preserve the data from the application and load preserved data on startup.

Here is a summary of what has been done:

  • Modify the Book class to add a new instance variable called id and the method to_json to convert the Book data into a hash.

  • Modify the Rental class to add a new instance variable called id.

  • Modify the Person, Student, and Teacher classes to receive an incremental id

  • Modify the Student and Teacher classes to add the to_json method that converts the data into a hash.

  • Create the DataRepository module that contains the following methods:
    -find_all_books: Read all the books' data from the books.json file
    -find_all_people: Read all the people's data from the people.json file
    -find_all_rentals: Read all the rentals' data from the rentals.json file
    -save_books: Write the books' data into the books.json file
    -save_people: Write the people's data into the books.json file
    -save_rentals: Write the rentals' data into the rentals.json file
    -get_data: This is a helper method that takes the name of a file with its extension, validates that the file exists, and extracts information from it.
    -insert_data: This is a helper function that receives the name of a file with its extension and the information to save, and writes or creates a file with that information.

  • Include the DataRepository module in the App class.

  • Modify the App class to get the books, people, and rental data from the JSON files when the app starts.

  • Modify the App class to save the books, people, and rental data into the JSON files when the app finishes its execution.

  • Update the menu method in the UserInterfaceActions class to call the finish method of the App class, which persists the data at the end of the application execution.

  • Update the README.md file

⭐To the code reviewer 👨‍💻

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

We 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 📞 us through Zoom or Slack, We're available on Microverse UTC-6 time zone.

ahmedeid6842 and others added 23 commits September 6, 2023 03:46
@NitBravoA92 NitBravoA92 added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 6, 2023
Copy link

@t-yanick t-yanick left a comment

Choose a reason for hiding this comment

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

STATUS: MILESTONE APPROVED 🥇

Hi @NitBravoA92 and @ahmedeid6842 ,

Great job !!!

To Highlight! 👏 🟢

✔️ Collaborative work 👍 Commits from both team members
✔️ Data is saved into JSON files
✔️ All methods to save data have been added
✔️ App works as expected

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

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.

You can also consider:

  • N/A

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 b3a8a0e into dev Sep 6, 2023
1 check passed
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