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

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

solution #676

wants to merge 3 commits into from

Conversation

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

Hey there! 👋 You've done a fantastic job overall, but there are a few areas that need your attention. Please consider using a different database for production or add 'db.sqlite3' to your .gitignore file. Also, there's no need to split the date, as it's already in the correct format. Lastly, please correct the grouping of your import statements. Keep up the good work! 🚀

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

@@ -11,7 +12,7 @@
MovieSessionListSerializer,
MovieDetailSerializer,
MovieSessionDetailSerializer,
MovieListSerializer,
MovieListSerializer, OrderSerializer, OrderListSerializer,
)

Choose a reason for hiding this comment

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

Code Style: Group imports using () if needed. The import statement for the serializers is not grouped correctly. The trailing comma should be removed from the last import inside the parentheses.

movie = self.request.query_params.get("movie")
if date and movie:
movie = self._params_to_int(movie)
queryset = queryset.filter(

Choose a reason for hiding this comment

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

Code Efficiency: Don't split the date, it's already in the format needed. The date variable is used in the filter without being split into year, month, and day.

queryset = queryset.filter(
show_time__contains=date,
movie__id__in=movie
)

Choose a reason for hiding this comment

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

Code Efficiency: Don't split the date, it's already in the format needed. The date variable is used in the filter without being split into year, month, and day.

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 the code! The models, serializers, and URL configurations are well-structured and efficient. However, there is a critical security issue that needs your attention - never publish your secret key in your code, and always use environment variables or a separate config file for sensitive information. Additionally, there are a few improvements you could make to enhance the code quality and efficiency, which have been pointed out in the comments. Keep up the good work and continue learning from your mistakes. 🚀👍

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

Comment on lines +98 to +108
movie = self.request.query_params.get("movie")
if date and movie:
movie = self._params_to_int(movie)
queryset = queryset.filter(
show_time__date=date,
movie__id__in=movie
)
elif date:
queryset = queryset.filter(
show_time__date=date
)

Choose a reason for hiding this comment

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

Code Efficiency issue: It seems you are splitting the date to filter the queryset (lines 101 and 107). According to the checklist, this is not an efficient way to filter by date. Try filtering the date directly without splitting it. Refer to the checklist for a good example.

Comment on lines +96 to +112

date = self.request.query_params.get("date")
movie = self.request.query_params.get("movie")
if date and movie:
movie = self._params_to_int(movie)
queryset = queryset.filter(
show_time__date=date,
movie__id__in=movie
)
elif date:
queryset = queryset.filter(
show_time__date=date
)
elif movie:
movie = self._params_to_int(movie)
queryset = queryset.filter(movie__id__in=movie)
return queryset

Choose a reason for hiding this comment

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

Code Quality issue: The if-elif-elif condition in lines 99-112 is not optimal. If the 'date' and 'movie' parameters are both present in the request, then the filter will be applied correctly. But if only 'movie' is present, it will be ignored because of the 'elif' condition. Consider changing the 'elif' conditions to 'if' so that each parameter is checked and applied independently.

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