Skip to content

Conversation

@dmdva
Copy link

@dmdva dmdva commented Nov 3, 2025

No description provided.

Copy link

@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

Good work on the overall structure and implementation of the Person class. The use of list comprehension is also well done.

However, this requires a change due to a critical functional issue. The Person.people class attribute is never cleared between calls to create_person_list. This causes data from previous calls to persist, leading to incorrect outputs if the function is run more than once. To fix this, you should clear the Person.people dictionary at the beginning of the function.

Additionally, while not a blocker, the code for linking spouses could be simplified by using dict.get() to fetch the person object, which is the recommended approach. [CHECKLIST ITEM #4]


✨ 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

def create_person_list(people: list) -> list:
# write your code here
pass
result = [

Choose a reason for hiding this comment

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

The Person.people dictionary is a class attribute and is never cleared. If this function is called multiple times, it will accumulate Person instances from all previous calls, leading to incorrect results. Consider clearing this dictionary at the beginning of the function to ensure it works correctly for multiple independent calls.

app/main.py Outdated
Comment on lines 23 to 24
if wife_name and wife_name in Person.people:
person.wife = Person.people[wife_name]

Choose a reason for hiding this comment

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

This violates checklist item #4: 'When accessing values in a dictionary, it is better to use the dict.get() method instead of explicitly checking for the presence of a key.' You can simplify this logic by using Person.people.get(wife_name) and then checking if the result is not None before assigning it.

app/main.py Outdated
Comment on lines 27 to 28
if husband_name and husband_name in Person.people:
person.husband = Person.people[husband_name]

Choose a reason for hiding this comment

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

This violates checklist item #4: 'When accessing values in a dictionary, it is better to use the dict.get() method instead of explicitly checking for the presence of a key.' Similar to the wife attribute, you can simplify this by using Person.people.get(husband_name) to retrieve the husband instance.

Copy link

@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.

@dmdva dmdva marked this pull request as draft November 3, 2025 15:45
@dmdva dmdva marked this pull request as ready for review November 3, 2025 15:45
@dmdva dmdva marked this pull request as draft November 3, 2025 15:45
@dmdva dmdva marked this pull request as ready for review November 3, 2025 15:46
Copy link

@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 fixing the critical bug from the last review by clearing the Person.people dictionary! The code is now functionally correct. However, one change is needed to fully align with the project's guidelines. The spouse-linking logic currently uses an in check on Person.people before accessing the value, which violates a checklist item [CHECKLIST ITEM #4]. You can simplify this by using Person.people.get(spouse_name) to retrieve the spouse's instance and check if the result is None in a single step. Please apply this pattern to finalize your solution.


✨ 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

app/main.py Outdated
Comment on lines 24 to 25
if wife_name and wife_name in Person.people:
person.wife = Person.people[wife_name]

Choose a reason for hiding this comment

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

This violates checklist item #4, which recommends using dict.get() instead of checking for key presence with in. You can simplify this by attempting to .get() the wife's instance from Person.people directly using wife_name as the key, and then checking if the result is not None. This same pattern should be applied to the husband-linking logic below.

Copy link

@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! I am approving your solution as it's now perfect. You've successfully addressed the feedback from the previous review by using dict.get() for spouse linking, which aligns perfectly with the project's guidelines [CHECKLIST ITEM #4]. The code is now clean, efficient, and fully compliant with all requirements. Great job finishing this up!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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.

2 participants