Skip to content

implemantação da solução - #3902

Open
Ricardo411 wants to merge 2 commits into
mate-academy:masterfrom
Ricardo411:develop
Open

implemantação da solução#3902
Ricardo411 wants to merge 2 commits into
mate-academy:masterfrom
Ricardo411:develop

Conversation

@Ricardo411

Copy link
Copy Markdown

implemantação da solução

@Ricardo411

Copy link
Copy Markdown
Author

implemantação da solução

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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:

  1. Removal of Dead Animals from Animal.alive (Checklist Item #2):

    • Currently, you are using indexOf and splice to remove dead animals from the Animal.alive array. The requirements explicitly state that you must use the filter method 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.
  2. Unnecessary Check in bite Method (Checklist Item #1):

    • Your bite method currently checks if the target is in Animal.alive (Animal.alive.includes(target)). The requirements specify that you should only check if the target is an instance of Herbivore and is not hidden, all in a single if statement.
    • How to fix: Remove the Animal.alive.includes(target) check from your if condition in the bite method.

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/herbivoresAndCarnivores.js Outdated
Comment on lines +13 to +16
const index = Animal.alive.indexOf(this);

if (index !== -1) {
Animal.alive.splice(index, 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread src/herbivoresAndCarnivores.js Outdated
@Ricardo411

Copy link
Copy Markdown
Author

x

@Ricardo411
Ricardo411 marked this pull request as draft August 12, 2025 17:27
@Ricardo411
Ricardo411 marked this pull request as ready for review August 12, 2025 17:40
@Ricardo411

Copy link
Copy Markdown
Author

c

@Ricardo411
Ricardo411 marked this pull request as draft August 12, 2025 17:41
@Ricardo411
Ricardo411 marked this pull request as ready for review August 12, 2025 17:42
@Ricardo411

Copy link
Copy Markdown
Author

c

@Ricardo411

Copy link
Copy Markdown
Author

ffff

@Ricardo411
Ricardo411 marked this pull request as draft August 12, 2025 17:46
@Ricardo411
Ricardo411 marked this pull request as ready for review August 12, 2025 19:42
@Ricardo411 Ricardo411 closed this Aug 13, 2025
@Ricardo411

Copy link
Copy Markdown
Author

cc

@Ricardo411

Copy link
Copy Markdown
Author

reabri

@Ricardo411

Copy link
Copy Markdown
Author

reabrir

@Ricardo411 Ricardo411 reopened this Aug 15, 2025
@Ricardo411
Ricardo411 marked this pull request as draft August 15, 2025 19:47
@Ricardo411
Ricardo411 marked this pull request as ready for review August 15, 2025 19:49
@Ricardo411

Copy link
Copy Markdown
Author

v

@Ricardo411

Copy link
Copy Markdown
Author

c

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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, and Carnivore classes using ES6 syntax and inheritance, which shows a solid grasp of JavaScript class structure.
  • The use of the static Animal.alive array and the filter method to manage living animals is correct and meets the requirements.
  • Your methods (hide and bite) 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 single if statement 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 = false for 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

  1. Rate AI review example

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 raulriato left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you should not leave comments on the project. Also, you should work your code to satisfy eslint rules, never disable eslint.

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.

3 participants