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 #21

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

Solution #21

wants to merge 2 commits into from

Conversation

MrEgorLite
Copy link

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 approve it:

  1. Schema Naming: The class names in schemas/movies.py are incorrect. They should be updated from MovieShema to MovieSchema to follow standard naming conventions. This change needs to be reflected in all relevant import statements as well.

  2. Schema Naming Requirements: According to the task requirements, the schema classes should be named MovieDetailResponseSchema and MovieListResponseSchema. Please update the class names to meet these requirements.

  3. Pagination Logic: The logic for determining the next_page URL should be reviewed. The condition page < 20 might not handle pagination correctly when the last page is reached. Consider using page < total_pages to ensure the next_page URL is only generated when there are more pages available.

Once these issues are resolved, please run the provided tests to ensure everything works as expected. Keep up the great work, and feel free to reach out if you have any questions! 🚀

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

from fastapi import APIRouter, Depends, HTTPException, Query
from schemas.movies import MoviesSchema, MovieShema

Choose a reason for hiding this comment

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

There is a typo in the import statement. MovieShema should be MovieSchema to follow standard naming conventions and avoid confusion.

prev_page = f"/theater/movies/?page={page - 1}&per_page={per_page}"

next_page = None
if page < 20 and total_items > count:

Choose a reason for hiding this comment

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

The condition page < 20 might not correctly handle the case when the last page is reached. Consider using page < total_pages to ensure the next_page URL is only generated when there are more pages available.

from sqlalchemy import DECIMAL


class MovieShema(BaseModel):

Choose a reason for hiding this comment

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

There is a typo in the class name MovieShema. It should be MovieSchema to follow standard naming conventions and avoid confusion.



class MoviesSchema(BaseModel):
movies: list[MovieShema]

Choose a reason for hiding this comment

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

After correcting the class name to MovieSchema, ensure that this reference is also updated to list[MovieSchema].

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 effort on your submission! 🎉 While your code is on the right track, there are a few important changes needed to fully meet the task requirements:

  1. Schema Naming:

    • The class names in schemas/movies.py should be updated from MoviesSchema and MovieSchema to MovieListResponseSchema and MovieDetailResponseSchema, respectively.
    • Ensure that all relevant import statements reflect these changes to maintain consistency across your codebase.
  2. Pagination Logic:

    • The logic for determining the next_page URL is correctly implemented using page < total_pages, which aligns with the task requirements. Well done on this part! 👍

Although these naming issues are critical for the functionality of the code, the decision to approve your Pull Request is made to help you move forward with your learning. Please address these issues in your next iteration to avoid similar problems in the future. Keep up the good work and continue improving your code! 🚀

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

from fastapi import APIRouter, Depends, HTTPException, Query
from schemas.movies import MoviesSchema, MovieSchema

Choose a reason for hiding this comment

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

The import statement should be updated to import MovieDetailResponseSchema and MovieListResponseSchema instead of MoviesSchema and MovieSchema to match the task requirements.

from sqlalchemy import DECIMAL


class MovieSchema(BaseModel):

Choose a reason for hiding this comment

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

The class name MovieSchema should be updated to MovieDetailResponseSchema to meet the task requirements.

country: str = Field(min_length=2, max_length=3)


class MoviesSchema(BaseModel):

Choose a reason for hiding this comment

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

The class name MoviesSchema should be updated to MovieListResponseSchema to meet the task requirements.

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