-
Notifications
You must be signed in to change notification settings - Fork 58
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 #46
base: main
Are you sure you want to change the base?
Solution #46
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on implementing the movie management endpoints! 🎉 The core functionality is solid, and you've met the task requirements well. There are a couple of areas for improvement: ensure the update_movie
function validates score
, budget
, and revenue
fields, and adjust the pagination logic to handle edge cases correctly. Keep up the good work and happy coding! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
db: Session = Depends(get_db) | ||
): | ||
total_items = db.query(MovieModel).count() | ||
total_pages = total_items // per_page + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calculation of total_pages
should be adjusted to correctly handle cases where total_items
is a multiple of per_page
. Consider using math.ceil(total_items / per_page)
to ensure the correct number of pages is calculated.
|
||
@router.patch("/movies/{movie_id}/") | ||
def update_movie(movie_id: int, movie_data: MovieUpdateSchema, db: Session = Depends(get_db)): | ||
movie = db.query(MovieModel).filter_by(id=movie_id).first() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The update_movie
function should validate the score
, budget
, and revenue
fields to ensure they meet the constraints specified in the task description. The score
should be between 0 and 100, and budget
and revenue
should be non-negative.
No description provided.