implemantação da solução - #3902
Conversation
|
implemantação da solução |
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
REQUEST_CHANGES
Thank you for your submission! Your implementation of the Animal, Herbivore, and Carnivore classes is clear and well-structured, and most requirements are met. However, there are two critical blockers that must be addressed before approval:
-
Removal of Dead Animals from
Animal.alive(Checklist Item #2):- Currently, you are using
indexOfandspliceto remove dead animals from theAnimal.alivearray. The requirements explicitly state that you must use thefiltermethod for this purpose. - How to fix: Replace your removal logic with:
Animal.alive = Animal.alive.filter(animal => animal.health > 0);
- This ensures compliance with the technical constraint and will pass the relevant tests.
- Currently, you are using
-
Unnecessary Check in
biteMethod (Checklist Item #1):- Your
bitemethod currently checks if the target is inAnimal.alive(Animal.alive.includes(target)). The requirements specify that you should only check if the target is an instance ofHerbivoreand is not hidden, all in a singleifstatement. - How to fix: Remove the
Animal.alive.includes(target)check from yourifcondition in thebitemethod.
- Your
Once you make these changes, your code should fully comply with the requirements. Great job on the rest of the implementation—you're very close! If you have any questions about the fixes, feel free to ask.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| const index = Animal.alive.indexOf(this); | ||
|
|
||
| if (index !== -1) { | ||
| Animal.alive.splice(index, 1); |
There was a problem hiding this comment.
This violates checklist item #2: 'Removal of dead animals from Animal.alive should be done using the filter method, not by using nested loops or indexOf + splice.'
You are using indexOf and splice to remove the animal. You must use Animal.alive = Animal.alive.filter(animal => animal.health > 0) or similar.
|
x |
|
c |
|
c |
|
ffff |
|
cc |
|
reabri |
|
reabrir |
|
v |
|
c |
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
This is an educational approval to help you continue progressing in your learning journey.
What you did well:
- You implemented the
Animal,Herbivore, andCarnivoreclasses using ES6 syntax and inheritance, which shows a solid grasp of JavaScript class structure. - The use of the static
Animal.alivearray and thefiltermethod to manage living animals is correct and meets the requirements. - Your methods (
hideandbite) are named and structured as specified, and you handled the logic for hiding and biting accurately. - The code is clean, concise, and avoids unnecessary checks or extra logic.
Areas for improvement:
- Always double-check that your conditional checks (especially in methods like
bite) are as concise as possible, using a singleifstatement when required. - Make sure that state changes (like removing dead animals from
Animal.alive) happen immediately after the relevant action, as you did here. - Continue to pay attention to property defaults (like
hidden = falsefor herbivores) and ensure they are set only where needed.
Keep up the great work! Your code meets all the functional and stylistic requirements for this task. As you move forward, keep focusing on clarity and precision in your logic—these are key skills for any developer. Well done!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]
If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]
If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]
If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]
If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.
raulriato
left a comment
There was a problem hiding this comment.
Normally, since the tests pass and the code looks okay, I would approve.
But you disabled eslint, so I'll request you to remove the comments.
|
|
||
| die() { | ||
| // Usar filter para manter apenas os animais com saúde maior que 0 | ||
| // eslint-disable-next-line prettier/prettier |
There was a problem hiding this comment.
you should not leave comments on the project. Also, you should work your code to satisfy eslint rules, never disable eslint.
implemantação da solução