Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Solution" #39

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

"Solution" #39

wants to merge 2 commits into from

Conversation

TIgor22
Copy link

@TIgor22 TIgor22 commented Jan 21, 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.

Thank you for your hard work on this Pull Request! There are a few critical issues that need to be addressed before we can proceed. The import statement for ceil is incorrect, and there are inconsistencies in the endpoint paths for pagination logic. Additionally, the limit method call needs to be corrected. Please make these changes to ensure the functionality aligns with the task requirements. Keep up the great work, and feel free to reach out if you need any assistance! 😊

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

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

@@ -1,10 +1,49 @@
from math import ceil

Choose a reason for hiding this comment

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

The import statement for ceil is incorrect. It should be from math import ceil instead of from math import ceil /++1++/.

skip = (page - 1) * per_page
limit = per_page

films = db.query(MovieModel).offset(skip).limit(limit=limit).all()

Choose a reason for hiding this comment

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

The limit method is incorrectly called with a keyword argument limit=limit. It should be limit(limit) without the keyword.

total_items = db.query(MovieModel).count()
total_pages = ceil(total_items / per_page)

prev_page = f"/theater/movies/?page={page - 1}&per_page={per_page}" if page > 1 else None

Choose a reason for hiding this comment

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

The endpoint path in prev_page is inconsistent with the defined route. It should be /movies/ instead of /theater/movies/.

total_pages = ceil(total_items / per_page)

prev_page = f"/theater/movies/?page={page - 1}&per_page={per_page}" if page > 1 else None
next_page = f"/theater/movies/?page={page + 1}&per_page={per_page}" if page < total_pages else None

Choose a reason for hiding this comment

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

The endpoint path in next_page is inconsistent with the defined route. It should be /movies/ instead of /theater/movies/.

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 on implementing the required endpoints and schemas! 🎉 Your code meets the task requirements and constraints, and the models are well-structured. However, there are a couple of critical issues that need your attention:

  1. Import Statement for ceil: The import statement for ceil is incorrect. Please ensure it is from math import ceil to avoid import errors.

  2. Endpoint Path Consistency: The root path is currently set to /theater, which is inconsistent with the pagination logic. It should be /movies to align with the endpoint paths.

These issues should be addressed to ensure the functionality aligns with the task requirements. Fixing them will help you avoid similar problems in the future. Keep up the good work, and continue learning from these experiences! 🚀

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

@@ -1,10 +1,50 @@
from math import ceil

Choose a reason for hiding this comment

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

The import statement for ceil is incorrect. It should be from math import ceil without the division operator.

total_items = db.query(MovieModel).count()
total_pages = ceil(total_items / per_page)

root = "/theater"

Choose a reason for hiding this comment

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

The root path is set to /theater, which is inconsistent with the endpoint paths used in the pagination logic. It should be /movies to match the endpoint paths.

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