Skip to content

'Solution'#1817

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

'Solution'#1817
Yurii-Hvozd wants to merge 2 commits into
mate-academy:masterfrom
Yurii-Hvozd:develop

Conversation

@Yurii-Hvozd

Copy link
Copy Markdown

No description provided.

@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

I am requesting changes because there are a few critical points that conflict with the task requirements and checklist.

Critical issues that must be fixed (blockers):

  1. In app/managers.py, the method all is annotated as -> None (around the method definition line) but it actually returns list[Actor]. The requirement says all must return a list of Actor (or an empty list), so the annotation is misleading; update it to something like def all(self) -> list[Actor]: or remove the annotation so it matches the behavior.
  2. In app/managers.py, inside the delete method, you call cursor.execute("DELETE ...") but never call self._connection.commit() afterward. This means deletions may not be persisted, and for consistent CRUD behavior (matching create and update), you need to add self._connection.commit() at the end of delete.
  3. At the bottom of app/managers.py, you have top-level code like:
    manager = ActorManager("actor_db.sqlite", "actors")
    manager.delete("1")
    print(manager.all())
    This creates a real SQLite file on import and violates the “Don’t push db files” checklist rule [CHECKLIST ITEM #1]. For the task, managers.py should only define ActorManager and related logic, so remove this block (or move it under if __name__ == "__main__": for personal testing, but it should not be part of the submitted solution).

Once you fix the return type of all, add the missing commit in delete, and remove the side-effectful bottom-of-file code that creates actor_db.sqlite, your solution will align well with the requirements. The core structure and CRUD logic are otherwise solid, so these changes will complete a good implementation.


✨ 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 app/managers.py Outdated
)
self._connection.commit()

def all(self) -> None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

all is annotated as returning None, but it actually returns a list of Actor instances; update the return type (e.g., -> list[Actor]) or remove the annotation so it matches the behavior required by the task.

Comment thread app/managers.py
)
self._connection.commit()

def delete(self, pk: int) -> None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

delete executes a DELETE but never commits the transaction, unlike create and update; add self._connection.commit() so deletions are persisted as required for correct CRUD behavior.

Comment thread app/managers.py Outdated
f"where id = ?", (pk,))


manager = ActorManager("actor_db.sqlite", "actors")

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 top-level code creates a real SQLite file (actor_db.sqlite) and runs operations on import; for the task, managers.py should only define ActorManager, and this pattern risks violating the checklist item about not pushing DB files—remove this block or move it under a guarded if __name__ == "__main__": used only locally.

@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

Your solution is approved because it fully meets the functional and structural requirements for this task. The Actor dataclass is correctly defined with id, first_name, and last_name, and lives in models.py as required. The ActorManager in managers.py correctly accepts db_name and table_name in __init__, creates the SQLite connection there, and ensures the CRUD methods (create, all, update, delete) behave as expected and commit their changes. The all() method returns a list[Actor] and properly handles the empty-table case, and there is no side-effectful top-level code creating a database file, which keeps you compliant with the checklist about not pushing .db files. The table name passed in tests is plural ("actors"), and your manager class name is singular (ActorManager), matching the naming conventions.

Nice work aligning your code with both the specification and the earlier review feedback; this implementation should pass the provided tests and is ready to move forward.


✨ 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