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

Develop #1068

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Develop #1068

wants to merge 3 commits into from

Conversation

Chukhno-Maksym
Copy link

No description provided.

Copy link

@ruslanyemets ruslanyemets left a comment

Choose a reason for hiding this comment

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

Great job!

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. Type Annotations for IDs: The functions get_movie_session_by_id and delete_movie_session_by_id are expected to take a single integer ID, but currently, they are annotated to accept a list. Please update the type annotations to int to reflect the correct input type.

  2. Return Type for get_movie_by_id: The function get_movie_by_id should return a single Movie instance, not a QuerySet. Please adjust the return type annotation to Movie.

  3. Misleading related_name Attributes: The related_name for the movie and cinema_hall ForeignKeys in the MovieSession model are misleading. They suggest a reverse relation that doesn't accurately represent the relationship. Consider changing them to something like 'movie_sessions' to better reflect the relationship.

Once these issues are addressed, your code will be in great shape! Keep up the great work, and I look forward to seeing the improvements. 🚀

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

services/movie.py Outdated Show resolved Hide resolved
services/movie_session.py Show resolved Hide resolved
services/movie_session.py Show resolved Hide resolved
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.


Great job on your submission! 🎉 You've made significant progress, and your code is mostly well-structured and functional. However, there are a few critical issues that need attention:

  1. Misleading related_name Attributes:

    • The related_name for the actors and genres fields in the Movie model is set to 'movies'. Consider changing them to 'actor_movies' and 'genre_movies' for better clarity.
    • The related_name for the movie and cinema_hall ForeignKeys in the MovieSession model is misleading. Changing them to 'movie_sessions' would better reflect the relationship.
  2. Return Type Annotations:

    • Ensure the get_movie_by_id function returns a Movie instance, not a QuerySet.
    • Similarly, the get_movie_session_by_id function should return a MovieSession instance.
  3. Return Statement in delete_movie_session_by_id:

    • Avoid returning the result of the delete() method, as its return value is not needed.

These adjustments will enhance the clarity and functionality of your code. Remember, addressing these issues will not only improve your current project but also help you in future endeavors. Keep up the great work, and continue learning from these experiences! 🚀

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

fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('show_time', models.DateTimeField()),
('cinema_hall', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cinema_halls', to='db.cinemahall')),

Choose a reason for hiding this comment

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

The related_name for the cinema_hall ForeignKey is misleading. It suggests a reverse relation that doesn't accurately represent the relationship. Consider changing it to something like 'movie_sessions' to better reflect the relationship.

('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('show_time', models.DateTimeField()),
('cinema_hall', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cinema_halls', to='db.cinemahall')),
('movie', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='movies', to='db.movie')),

Choose a reason for hiding this comment

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

The related_name for the movie ForeignKey is misleading. It suggests a reverse relation that doesn't accurately represent the relationship. Consider changing it to something like 'movie_sessions' to better reflect the relationship.

migrations.AlterField(
model_name='movie',
name='actors',
field=models.ManyToManyField(related_name='movies', to='db.actor'),

Choose a reason for hiding this comment

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

The related_name for the actors ManyToManyField is set to 'movies', which might not accurately represent the relationship. Consider changing it to something more descriptive, such as 'actor_movies', to better reflect the relationship.

migrations.AlterField(
model_name='movie',
name='genres',
field=models.ManyToManyField(related_name='movies', to='db.genre'),

Choose a reason for hiding this comment

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

The related_name for the genres ManyToManyField is set to 'movies', which might not accurately represent the relationship. Consider changing it to something more descriptive, such as 'genre_movies', to better reflect the relationship.

class Movie(models.Model):
title = models.CharField(max_length=255)
description = models.TextField()
actors = models.ManyToManyField(Actor, related_name="movies")

Choose a reason for hiding this comment

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

The related_name for the actors ManyToManyField is set to 'movies', which might not accurately represent the relationship. Consider changing it to something more descriptive, such as 'actor_movies', to better reflect the relationship.

title = models.CharField(max_length=255)
description = models.TextField()
actors = models.ManyToManyField(Actor, related_name="movies")
genres = models.ManyToManyField(Genre, related_name="movies")

Choose a reason for hiding this comment

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

The related_name for the genres ManyToManyField is set to 'movies', which might not accurately represent the relationship. Consider changing it to something more descriptive, such as 'genre_movies', to better reflect the relationship.

return queryset


def get_movie_by_id(movie_id: int) -> Movie:

Choose a reason for hiding this comment

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

The return type annotation for get_movie_by_id should be Movie, as the function returns a single Movie instance, not a QuerySet.

return MovieSession.objects.all()


def get_movie_session_by_id(movie_session_id: int) -> MovieSession:

Choose a reason for hiding this comment

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

The return type annotation for get_movie_session_by_id should be MovieSession, as the function returns a single MovieSession instance, not a QuerySet.



def delete_movie_session_by_id(session_id: int) -> None:
return 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.

The delete_movie_session_by_id function should not return the result of the delete() method. Simply call delete() without returning its result, as the return value is not needed.

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