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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solution #1077

wants to merge 1 commit into from

Conversation

SummerKatrin
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! 😊 While you've made great progress, there are a few critical issues that need to be addressed before we can approve it:

  1. Exception Handling: It's important to handle cases where a movie or movie session with a given ID does not exist. Consider using get_object_or_404 or handling the DoesNotExist exception for MovieSession.objects.get(id=session_id), Movie.objects.get(id=movie_id), and CinemaHall.objects.get(id=cinema_hall_id). This will prevent the application from crashing when invalid IDs are provided.

  2. Model References: Please ensure that the Actor and Genre models exist in the db app, as they are referenced in the ManyToManyField for the Movie model. If these models do not exist, it will cause errors during migration.

Once these issues are resolved, your code will be in great shape! Keep up the good work, and don't hesitate to reach out if you need any help. 🚀

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

Comment on lines +29 to +30
('actors', models.ManyToManyField(to='db.Actor')),
('genre', models.ManyToManyField(to='db.Genre')),

Choose a reason for hiding this comment

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

Ensure that the Actor and Genre models exist in the db app, as they are referenced in the ManyToManyField for the Movie model. If they do not exist, this will cause an error during migration.



def get_movie_by_id(movie_id: int) -> Movie:
return Movie.objects.get(id=movie_id)

Choose a reason for hiding this comment

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

Consider using get_object_or_404 or handling the DoesNotExist exception to manage cases where a movie with the specified ID does not exist. This will prevent the application from crashing if an invalid ID is provided.

Comment on lines +15 to +16
movie=Movie.objects.get(id=movie_id),
cinema_hall=CinemaHall.objects.get(id=cinema_hall_id)

Choose a reason for hiding this comment

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

Consider handling the DoesNotExist exception for Movie.objects.get(id=movie_id) and CinemaHall.objects.get(id=cinema_hall_id) to manage cases where the provided IDs do not exist. This will prevent the application from crashing if invalid IDs are provided.



def get_movie_session_by_id(movie_session_id: int) -> MovieSession:
return MovieSession.objects.get(id=movie_session_id)

Choose a reason for hiding this comment

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

Consider using get_object_or_404 or handling the DoesNotExist exception to manage cases where a movie session with the specified ID does not exist. This will prevent the application from crashing if an invalid ID is provided.

movie_id: int = None,
cinema_hall_id: int = None
) -> None:
movie_session = MovieSession.objects.get(id=session_id)

Choose a reason for hiding this comment

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

Consider handling the DoesNotExist exception for MovieSession.objects.get(id=session_id) to manage cases where the provided session ID does not exist. This will prevent the application from crashing if an invalid ID is provided.



def delete_movie_session_by_id(session_id: int) -> None:
MovieSession.objects.get(id=session_id).delete()

Choose a reason for hiding this comment

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

Consider handling the DoesNotExist exception for MovieSession.objects.get(id=session_id) to manage cases where the provided session ID does not exist. This will prevent the application from crashing if an invalid ID is provided.

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.

3 participants