-
Notifications
You must be signed in to change notification settings - Fork 24.2k
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
Pet details are not updated #1752
Comments
Hey ! |
It seems that I cannot assign anybody to the issue, I dont know why, but feel free to fix the issue. |
Okey ! |
Hello ! |
The solution is good and solves the problem. I would only suggest to put the whole logic with the for loop into a new method in the Owner (maybe call it updatePet). And I am not sure why you renamed the PetController to privatePetController. |
Okey...sure ! I will correct the things. |
I have created a new PR. Please review it ! |
@smnk107 |
Thanks for checking this out. I have removed the commented code. Please review it when you have the time. Let me know if further improvements are needed. Thanks! |
Hi @smnk107, Thank you for the recent changes! The PR looks great overall, and I appreciate your work on the updatePet() implementation in the Owner class. Upon reviewing the code again, I noticed that the function iterates over the pets list and compares each Pet object with the updated pet object using the pet_Id. To make the implementation cleaner and more efficient, I suggest leveraging the existing getPet(Integer id) method within the updatePet() function. By doing so, you can directly retrieve the relevant Pet object and replace it with the updated version, avoiding the need for a loop. This adjustment would enhance code readability and reduce potential overhead. Once this change has been incorporated, I’ll be happy to approve the PR. Please let me know if you need any assistance with the update. Thank you again for your contribution! |
… or name wasn't persisting - Updated processUpdateForm to modify existing pet instead of adding new one - Added proper handling of existing pet update Fixes spring-projects#1752
Dear @abdurraffaysyed Thank you for reviewing the PR and for your constructive feedback! I appreciate the suggestion to use the getPet(Integer id) method within the updatePet() function to streamline the implementation. It’s a great idea, and I agree that it will enhance the code's readability and efficiency. I’ve incorporated the changes. Please let me know if there’s anything else you’d like me to address. Looking forward to your review and approval! Thanks again for your guidance and support! |
Thank you for addressing my feedback and incorporating the suggested changes into your pull request. I have reviewed and approved your PR. Looking forward to seeing more contributions from you in the future. |
Thank you for reviewing and approving my pull request! This was my first open-source contribution, and your feedback and support have made it an amazing experience. I'm excited to continue contributing and learning! |
Example: go to first owner with pet Leo of type cat.
Click on edit pet and change the type to bird or change the name.
Click on Update pet.
The pet is not updated, even though a success message is shown.
When I analysed the code, I found that the updated pet is given to the addPet method of the owner which does not change the pet in the owner list, as the pet is not new.
In PetController:
The text was updated successfully, but these errors were encountered: