Skip to content

solved 3#1707

Open
kennyprog wants to merge 4 commits intomate-academy:masterfrom
kennyprog:develop
Open

solved 3#1707
kennyprog wants to merge 4 commits intomate-academy:masterfrom
kennyprog:develop

Conversation

@kennyprog
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Review Summary

Great job on implementing the spider movement and boundary checks! Your solution is very close to complete.

However, I'm requesting a change because the spider's size is hardcoded. A key requirement is that the code must work for a spider of any size without hardcoded values. This is also causing the automated tests to fail, as the spider isn't being centered correctly on the click.

To fix this, you should get the spider's dimensions dynamically from the DOM element. You can use spider.offsetWidth and spider.offsetHeight to get its width and height. Then, use these values to calculate the correct centered position, for example:

const newLeft = event.clientX - spider.offsetWidth / 2;

Once you make this change, your solution should pass all the requirements. Keep up the great work!


✨ 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/scripts/main.js Outdated
const spider = document.querySelector('.spider');
const wall = document.querySelector('.wall');

const spiderSize = 50;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The task requires the code to work with spiders of any size and avoid hardcoded values. Instead of 50, you should get the spider's size dynamically from the DOM element. Properties like spider.offsetWidth or spider.getBoundingClientRect().width can be used for this.

Copy link
Copy Markdown

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

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.

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Review Summary

While you've done a great job addressing the previous feedback, some changes are needed as the automated tests are failing due to an issue with the spider's positioning. The spider's center is not correctly aligning with the cursor on click.

To fix this, you need to account for the spider's own dimensions in your position calculation. After getting the click coordinates from event.clientX and event.clientY, you should subtract half of the spider's offsetHeight and offsetWidth respectively. This will ensure the spider is perfectly centered on the cursor.

Here's an example of the logic:

const newTop = event.clientY - spider.offsetHeight / 2;
const newLeft = event.clientX - spider.offsetWidth / 2;

Please adjust your calculation, and the tests should pass. Keep up the good work!


✨ 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

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Review Summary

Excellent work on this task! Your code is clean and correctly uses dynamic properties like offsetWidth instead of hardcoded values. I am approving this solution as an educational override to help you progress, but please note that the automated tests have detected a small issue with the spider's final positioning.

The tests indicate the spider isn't perfectly centered under the cursor. This is a common challenge and is often fixed by adjusting the final coordinates. To fix this, try subtracting half of the spider's width from the left position and half of its height from the top position. You are very close to a perfect solution, keep up the great effort!


✨ 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

Copy link
Copy Markdown

@Anton-Kuchmasov Anton-Kuchmasov left a comment

Choose a reason for hiding this comment

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

Hey, to get your solution approved, you should pass all tests - it's mandatory.
If you're stuck, feel free to ask help in fe_chat

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